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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URGENT ASSISTANCE WITH JSP FORWARDING

Status
Not open for further replies.

owendodd

Programmer
Apr 1, 2004
3
IE
Hello i wish to forward to different url based on the values have entered on my jsp form. To be more specific i have a drop down with a list such as Health and Legal. What i want to do i that when i submit to the database ( i enter my details successfully to the database[which i can do successfully] but i want to when i submit to foward onto a health.jsp or a legal.jsp based what i have chosen from the drop down. I wish to code this in jsp!PLEASE HELP!!!!!!!!!!!!!1
 
One way is ... The client html page (with the form) submits to a jsp page which updates the database
Code:
<form action="processForm.jsp" method="post">
...
...
</form>
processForm.jsp updates the database and redirects to the approriate page using RequestDispatcher
Code:
String dropDownVal = request.getParameter("dropdown");
String url = dropDownVal + ".jsp";
RequestDispatcher rd = request.getRequestDispatcher(url);
response.resetBuffer();
rd.forward(request,response);
return;
Greg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top