This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes HTTP Servlet Response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Servlet Response " Watch "HTTP Servlet Response " New topic
Author

HTTP Servlet Response

Ram Thirumangalam
Greenhorn

Joined: Aug 28, 2003
Posts: 20
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

Joined: Jan 10, 2002
Posts: 60739
    
  65

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ram Thirumangalam
Greenhorn

Joined: Aug 28, 2003
Posts: 20
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

Joined: Aug 26, 2002
Posts: 42
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


Sun Certified Java Programmer 2 (1.4)<br />Sun Certified Web Component Developer
Ram Thirumangalam
Greenhorn

Joined: Aug 28, 2003
Posts: 20
Thank you guys. It was really helpful and now I am able to make it work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Servlet Response
 
Similar Threads
object doesn't support the property or method
how does the servlet knows that the client has closed the browser
Browser window and applet frame
favicon icon configuration in tomcat 6
PDF generation from a servlet