File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Need help with forwarding on JSP based on value selection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Need help with forwarding on JSP based on value selection" Watch "Need help with forwarding on JSP based on value selection" New topic
Author

Need help with forwarding on JSP based on value selection

owen dodd
Greenhorn

Joined: Apr 01, 2004
Posts: 7
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
[ April 01, 2004: Message edited by: Bear Bibeault ]
li jian
Greenhorn

Joined: Apr 01, 2004
Posts: 1
You want to submit the jsp to different url's based on the
the value selected in the drop down box. I hope i got that right.
I will advice u to do that coding in a client side scripting language
like Java Scipt or Vb script.
u could call a java script function when the submit button is clicked
and choose the url based on the value and then forward the page to that url.U could find the code in any java script book.
I hope i have solved ya problem, please let me know if ya have any doubts.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50677

Moving this to the HTML/Javascript forum as this is a client-side activity. I'll meet you there!


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50677

In a Javascript change handler for your dropdown, all you need to do is to swap out the action property of the form to the appropriate URL.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
look at this script here: http://www.javascriptkit.com/script/cut147.shtml
Eric
owen dodd
Greenhorn

Joined: Apr 01, 2004
Posts: 7
Thank for this piece of code inside my form of which i am using to insert a student to my database. I was wonderin how do i go about changing my struts-configfile.xml?
Thank for the help
 
IntelliJ Java IDE
 
subject: Need help with forwarding on JSP based on value selection
 
Threads others viewed
JSP and JavaScript
Dependent drop down boxes with javascript
How can code the selected value in the JSP
Adjusting submission target using form element information
dependent drop down list
developer file tools