File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes calling servlet from jsp with showing message on screen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "calling servlet from jsp with showing message on screen " Watch "calling servlet from jsp with showing message on screen " New topic
Author

calling servlet from jsp with showing message on screen

diana b
Greenhorn

Joined: Feb 02, 2001
Posts: 6
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

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Jan 07, 1999
Posts: 6920
"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.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calling servlet from jsp with showing message on screen