• Post Reply Bookmark Topic Watch Topic
  • New Topic

Streaming jsp output to a file

 
Derek Clarkson
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a requirement to call a jsp and output the resulting html into a file so it can be an email. Presently our system does this by setting up a url object and grabbing the output. However I was wondering if there is a way to do this by calling the jsp engine directly without having to go through the url object.

Anyone know if this can be done ?

ciao
Derek.
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving this to the JSP forum.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to go through the appserver because it handles a lot of stuff for the JSP engine like session management, state, etc.
 
Derek Clarkson
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I have been looking for is a method somewhere that would allow me to request the processed output of a page. For example

<some class>.getJSPReader(String jspURL)

Which returns the processed output from the JSP. Anyone seen anything like this ?

ciao
Derek.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which returns the processed output from the JSP. Anyone seen anything like this ?


No, but one should be fairly straight-forward to write using java.net.URLConnection.
 
satish sathineni
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Derek

I am not clear about u r exact requirement but as far i understood u want to write the out put of html out from jsp to a file ...

If that is the case then u can do this way...

response.setContentType("xx") format should be mentioned here..
ServletOutputStream sos = response.getOutputStream();
u should write the out to byteBuff[] array and write it to the SOS so that it would help u to write to the file ...
sos.write(byteBuff[]);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!