Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling servlet from jsp with showing message on screen

 
diana b
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
I have a jsp page that calls servlet, passing there all data.
I am using <FORM NAME="Form1" method="post" action="ServletName" onSubmit="return submitForm(this)">
Also I need to display message on screen (when user click on submit button), since this is a last screen for user, but process will be continue inside of servlet.
I am not sure and where it shouldbe done, I mean inside of jsp page or inside of servlet. I tried to do this inside of servlet,
using:
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println(" <HTML><HEAD><TITLE> Employee Information </TITLE></HEAD>");
out.println(" <BODY BGCOLOR=\"#fdeed5\" TEXT=\"#000000\" >");
out.println(" <H3><B><CENTER><FONT FACE=Arial, Helvetica> Request was submitted </FONT></CENTER></B></H3>");
out.println(" </BODY></HTML>");
return;
But after 'return' control will not be returned to the servlet.
I would really appreciate any help and sample code.
Thanks
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about using out.flush() ?

Or you can use response.sendRedirect("endPage.htm"), and the code after this line will continue processing your form input, meanwhile your browser has been redirected to the endPage.htm.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"diana b",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic