Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

How Do I Turn A JSP Screen Into A File?

Thread view: 
MattC - 20 Oct 2005 13:10 GMT
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
screen, put it in a file and send it to them via web services. The
information does not have to be formatted in the same way as it is on
the screen but that is desirable. I am looking for options on how to
accomplish this.

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
and in addition I will have to keep the data file in sync with any
changes made to the jsp.

Is there an easier way to accomplish this by using the http response or
some other cleaver approach?

Any ideas are appreciated.
Dave Glasser - 20 Oct 2005 13:22 GMT
"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

Andrea Desole - 20 Oct 2005 13:28 GMT
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.