I'm making a select box with dates so I created a loop for the options like this:
<select name="BDay" />
<%
for (int i = 1; i <= 31; i++) {
out.print("<option value=" + i + ">");
out.print(i);
out.print("</option>");
} %>
</select>
<select name="BMonth" />
<%
for (int j = 1; j <= 12; j++) {
out.print("<option value=" + j + ">");
out.print(j);
out.print("</option>");
}
%>
</select>
<select name="BYear" />
<%
for (int k = 1915; k <= 2011; k++) {
out.print("<option value=" + k + ">");
out.print(k);
out.print("</option>");
}
%>
</select>
and then in a different page when I try to get the information the user picked (like this):
int BDay = Integer.parseInt(request.getParameter("BDay"));
int BMonth = Integer.parseInt(request.getParameter("BMonth"));
int BYear = Integer.parseInt(request.getParameter("BYear"));
I get this error: java.lang.NumberFormatException: null
Can someone please help? Thanks in advance!