Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternitive to Println Statment in Servlet

Status
Not open for further replies.

NJDrew

Technical User
Dec 21, 2001
31
US
Ok, I have a servlet that is being called by one html page and after it does its processes, I want it to desplay another page. I am new to Java and the only way I know of is to use a out.Println statement to create a new page. What I want it to do after the processes is to open/load a pre-exsiting html page. How do I have the servlet do this.

Any help would be greatly appricated.

Thanks,
Drew "Mistakes are the portals of discovery"
James Joyce
 
Use a RequestDispatcher to forward the request to the new page. You can get a RequestDispatcher from the HttpServletRequest. Check the Javadocs for more information.
 
If you are not interested in passing on any parameters from the servlet to the new html page, you could simply do:

response.sendRedirect( "newHtml.html" );

-gc "I don't look busy because I did it right the first time."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top