This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi all. I am using JSTL for my JSP. In my select list i need to pass two value. For example.
This will allow me to get only the id .But i want to get the selected Name also.Basically i wanted both the id and name .Is there any way to do this. I know there is <c:forTokens> but dont know how to use it.
Regardless of how you construct the HTML on the server side, when a select element is submitted, it will submit the value of the selected option, not the option text.
If you need that as well (seems like a pretty poor design to me, a properly constructed model should be able to pull up any information using the id as the primary key of the element), you will need to write an onsubmit handler that can find the text of the selected option and copy it to a hidden element in your form so that it will get submitted in addition to the option value.