PDA

View Full Version : jsp and combobox


midou_gi
10-21-2009, 09:44 AM
In my jsp page i have a form in which i have a first combobox and i would after changing the value of an item that another combobox apears. So i used a proposition but it didn't work :(
<select name="sec" onchange="<c:set var="section" value="${param.sec}"/>">
<option id="option1">1</option>
<option id="option2">2</option>
<option id="option3">3</option>
</select>
<c:if test="${(section==3)}">
<select name="options">
....
</select>
</c:if>
Or to create a variable after the first combobox in which i put the first value selected without onchange function.
<c:set var="section" value="${param.sec}"/>
<c:if ....>
...
</c:if>




but the 2nd combobox appears after submitting.

So are there another solution using jsp commands or things like that (i tried with javascript but may be it s not good to use javascript and jsp at the same time)

ckeyrouz
10-21-2009, 04:27 PM
If you want to use jsp only you have to submit, otherwise there is no way that you can do it without javascript.

Besides it is not harmful to use javascript inside a jsp page but it is better to put the javascript code in a separate file and include in you jsp page in order to minimize the traffice on the network when calling the jsp page.

Hope this was clear for you.