aspose file tools*
The moose likes Servlets and the fly likes Can a servlet RETURN it's generated html to it's caller? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Can a servlet RETURN it Watch "Can a servlet RETURN it New topic
Author

Can a servlet RETURN it's generated html to it's caller?

Catriona McCann
Greenhorn

Joined: Aug 31, 2000
Posts: 24
Hi,
Is it possible to get a servlet to return the html it created, rather that writing it out to the browser itself ?? I want this servlet to update a div on the previous page ..???
Is this possible - if so - how ??
Thanks in advance !
sridhar satuloori
Ranch Hand

Joined: Nov 05, 2001
Posts: 144
I have an idea!! i donno how much useful it is... lemme try it
in doGet/doPost method instead of writing the output to PrintWriter/OutputStream, just buffer the output and send that info as part of the name/value pair in the ServletRequest object. if you have huge amount of data better write it to some file and send that file info through your request parameters.
Does the make any sense
Sridhar
Catriona McCann
Greenhorn

Joined: Aug 31, 2000
Posts: 24
Thanks for the reply ! ...
The calling page is generated using an XSL style sheet where I display some results.. basically when the user clicks a certain button, I want to call a servlet which will generate new results . I then want to write these NEW results back to the origional page .... but not over write all of the previous data - just part of it ! ...??? !

Originally posted by sridhar satuloori:
I have an idea!! i donno how much useful it is... lemme try it
in doGet/doPost method instead of writing the output to PrintWriter/OutputStream, just buffer the output and send that info as part of the name/value pair in the ServletRequest object. if you have huge amount of data better write it to some file and send that file info through your request parameters.
Does the make any sense
Sridhar

Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
I'm still not seeing exactly what you want to do. But you do knonw that you can do a RequestDispatcher.include() to have multiple servlets or JSP's contribute to the output of a single page, right?
Are you just saying that you want to have one servlet generate the output of a page and then only contribute changes to that page when the user presses a button? Unless you use Frames HTTP donesn't allow this -- it's a full page at a time...
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Can a servlet RETURN it's generated html to it's caller?