I'm using some code where I'm getting NumberFormatException in the code but logically it seem to me perfectly ok because whenever I 'm using that code in .java file it works perfectly ok but when I'm using same type of code in a jsp it throws the exception. Code i'm is some thing like that:`print("<% String t=request.getParameter("time"); /* "time" is the name of the textfield from which I'm getting the value. I also initialized the textfield with value="0000" */ int t1=Integer.parseInt(t); %> ");`
Hello Friend,
The correct way to get the parameter value is:
<% try{ String t=request.getParameter("time"); int t1=Integer.parseInt(t); out.println(t1); } catch(Exception e){ out.println(e); } %>
Thanks
Ads