I have the following code in a jsp file (on Adobe CQ) but, it returns null. Not sure why. I am expecting the out.println line to return 40 since it is the default selected value.
<select id="itemsperpage" name="itemsperpage">
<option value="20">20</option>
<option value="40" selected>40</option>
<option value="100">100</option>
<option value="200">200</option>
</select>
<%
String itemsPerPage = request.getParameter("itemsperpage");
out.println("Items: " + itemsPerPage );
%>
your code will always return
null
. try to seepage source
after running your application. value ofItems
is alwaysnull
.try following code: (in this code I am sending a request on every time the value of combobox is changed)
[Note: i will suggest you to not use
scriplets
in your jsp file, instead you can go for AJAX , JSTL etc. ]