• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Catriona McCann
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic