• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

calling servlet from jsp with showing message on screen

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic