Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

not sure what is wrong here  RSS feed

 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the following error:
java.lang.NumberFormatException:
I am not sure what is wrong?
<form name="Escc" method="POST" action=" ">
<%
String passedDobMn = (String) request.getParameter("dobMn");
if (passedDobMn==null) passedDobMn="";
String months[] = {
"January" , "February" , "March" , "April", "May",
"June", "July", "August", "September", "October",
"November", "December"};
int m = Integer.parseInt( passedDobMn )-1;
%>
<select name="dobMn" >
<OPTION >month
<%
String sel = "";
for (int i=0;i<months.length;i++) {
if (i==m) sel = "selected";
else sel = "";%>
<option value="<%= i %>"<%= sel %>><%= months[i] %></option><%
}%>
</select>
</form>
</body>
</html>
 
Francois Bourgault
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mary
Change the following line :
if (passedDobMn==null) passedDobMn="";

to: if (passedDobMn==null) passedDobMn="0";
and it will work.
Francois.
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Francois,
Yes, Thank you. Now it works perfect!!
THANKS
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!