Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help with forwarding on JSP based on value selection  RSS feed

 
owen dodd
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ninkuma
Marshal
Posts: 66256
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the HTML/Javascript forum as this is a client-side activity. I'll meet you there!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66256
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
look at this script here: http://www.javascriptkit.com/script/cut147.shtml
Eric
 
owen dodd
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!