how to display the selected options below in jsp
<td width="75%" valign="center">
Start Date :
<input id="startDate" name="startDate" id = "startDate" type="text" size="20"><a href="javascript:NewCal('startDate','ddmmyyyy')"><img src="$
Start Time :
<select name="startTime" id = "startTime">
<option value="0">10:00</option>
<option value="1">11:00</option>
<option value="2">12:00</option>
<option value="3">13:00</option>
<option value="4">14:00</option>
<option value="5">15:00</option>
<option value="6">16:00</option>
<option value="7">17:00</option>
<option value="8">18:00</option>
<option value="9">19:00</option>
<option value="10">20:00</option>
<option value="11">21:00</option>
</select>
</td>
i thought request.getParameterValues will be valuable but it shows only something like value="something" only but not the value between both of options tag.
Any ideas? thanks in advance
Best way is using EL (expression language). Request parameters are available as implicit objects in EL.
${param.startTime}equalsrequest.getParameter("startTime").If you need the option’s text instead of the value it’s best to create an
ArrayListofStringswhich you can use to generate the dropdown and to look up the value:You can use JSTL (
c:forEach) to generate the list using the index (see thevarStatusattribute) as your option’svalue:You can then use the
value(index) to get an item from your list:${startTimeList[param.startTime]}.