"MattC" <matthew.n.connors@lmco.com> wrote on 20 Oct 2005 05:10:18
-0700 in comp.lang.java.programmer:
>I have a fairly complex jsp screen that contains 5 tabs and a few
>hundred data elements. The customer wants me to take the data on the
[quoted text clipped - 10 lines]
>Is there an easier way to accomplish this by using the http response or
>some other cleaver approach?
Presumably your data elements live inside a database, or a file, or
some other source and the JSP page uses them to dynamically build the
HTML. If that's the case, it seems the simplest thing to do would be
to build a web service that reads the data from its original source,
rather than scraping the HTML.
If, OTOH you're saying that the data actually lives inside the JSP
file -- for example, the JSP file contains a list of items for sale,
and if the price of one is changed, you have to physically edit the
JSP file -- then you have a real mess on your hands. I would advise
you to separate the data from the presentation. If putting it into a
database isn't practical, put it into a simple text file, for example
a CSV (comma-separated values) file, which both the JSP and the web
service would read.

Signature
Check out QueryForm, a free, open source, Java/Swing-based
front end for relational databases.
http://qform.sourceforge.net
If you're a musician, check out RPitch Relative Pitch
Ear Training Software.
http://rpitch.sourceforge.net
> One way is to just build a file programmatically totally separate from
> the jsp. That will work but certainly doesn't seem to be an easy way
[quoted text clipped - 3 lines]
> Is there an easier way to accomplish this by using the http response or
> some other cleaver approach?
you are probably on the right way when you talk about building a file
programmatically. This is what you can do.
You use a servlet filter. In the filter you replace the original servlet
response with your own response wrapper. The getWriter() method of your
wrapper will give your own PrintWriter, which will write everything to
the PrintWriter of the original reponse (wrapped by your wrapper) and to
your separate file.
Of course, if you do this you will lose all the information about
stylesheets and pictures, which are on different files. You will just
write the html coming from your jsp.