Reqest.getparameter() Returns Null For Select Box In Jsp
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. &
Solution 1:
your code will always return null
. try to see page source
after running your application. value of Items
is always null
.
try following code: (in this code I am sending a request on every time the value of combobox is changed)
<html><head><metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><bodyonload="form1.submit();"><formaction="#"name="form1"><selectid="itemsperpage"name="itemsperpage"onchange="submit();"><optionvalue="20">20</option><optionvalue="40"selected>40</option><optionvalue="100">100</option><optionvalue="200">200</option></select></form>
<%
String itemsPerPage = request.getParameter("itemsperpage");
out.println("Items: " + itemsPerPage );
%>
</body></html>
[Note: i will suggest you to not use scriplets
in your jsp file, instead you can go for AJAX , JSTL etc. ]
Post a Comment for "Reqest.getparameter() Returns Null For Select Box In Jsp"