• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet responses

 
Aaron Robinson
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a servlet send more than one response or how could you mimic this. When an HTML form is submitted I need to send a PDF to a new window and a "Has the form been successfully printed" dialog to the original window.
I know how to send the PDF to a new window from the servlet but wondered how I could also send the prompt from the same servlet.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13077
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have one servlet return all sorts of differnt response, but each transaction (request - response) can only be of one type. Seems to me your page with the original form would have to make a second request - maybe with Javascript after a delay?
 
Aaron Robinson
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill,
I think I have the answer. It's a neat bit of server push that I require. What I can do in the servlet is send two responses, the first will go to the original window and will simply be a prompt to see if the form printed successfully, the second is the PDF document that contains a prepopulated form ready for printing.
I found the answer in James Hunter's Servlet programming under server push. You can set the content type to multi something and then send multiple responses.
How's your JSP book coming along by the way. I'm thinking of doing a J2EE book based on personal experience. Are technical books worth the effort from a financial gain perspective?
Thanks
Aaron
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic