• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Servlet Response

 
Ram Thirumangalam
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a question regarding the Servlet Response. First, let me make clear that I am a novice to JAVA as well as Servelt programming. So Please bear with any questions that seem to be silly.
Now, Here is the main issue. Upon executing a servlet, the current code creates a PDF document dynamically on the fly from data that I receive from my host and writes it out to a new browser window using the servletoutput stream (response.setContentType("application/pdf")).
Now, I wish to create two frames in the new browser window and want the PDF document to be opened in one of the frame while putting some text messages in the other frame. So is it possible to direct the PDF output to the specific frame? If so please let me know.
Any help would be greatly appreciated.
Thanks
Ram.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ram, welcome to the Ranch where beginnner questions are more than welcome!
But no, it is not possible from the response to direct where the response will go. It will always be delivered to the window/frame in which the request was made.
How I would approach this is to back up and make it so that whatever triggerred the action in the first place causes two requests: one into the frame in which you want the text, and one to get the PDF into its own frame. You'll probably need some Javascript to cause a single action (button push?) to trigger the two separate requests.
If so, this is a great question for the HTML/Javascript forum.
hth,
bear
[ August 28, 2003: Message edited by: Bear Bibeault ]
 
Ram Thirumangalam
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bear
Thank you very much for the information. I have been trying hgard to find out if it is feasible.
So you mean that I need to execute two servlets (one for PDF and another for Text for the respecive frame) for the actions that occur for a single push (say button click). I will post any messages in the javascript forum if I have further questions regardign this.
Will try this suggestion and let u know
Thanks
Ram.
 
maneesh subherwal
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think how you could do this is have a dummy servlet to only open the frames window sending information that it needs to generate the pdf.
Next, onloading the frame browser window, call the pdfservlet from one frame and either write out your text in the other frame, if static or use another servlet.
I hope this helps...
basically,
request --> dummyServlet --> open new browser with two empty frames
in frame 1 use javascript onLoad --> call pdfServlet
in frame 2 use javascript onLoad --> call textServlet
Therefore you would need 3 servlets.
Thank you,
Maneesh
 
Ram Thirumangalam
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys. It was really helpful and now I am able to make it work.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic