r_muthu
asked on
convert String to int in JavaServer Pages
How can I convert String to int in JavaServer PagesTM?
I'm having a problem converting String to int on JavaServer Pages. This is the code I used:
<%
String ss= request.getParameter("prio r");
int ii = Integer.parseInt(ss);
%>
ii=<%=ii%>
The output i got is
A Servlet Exception Has Occurred
java.lang.NumberFormatExce ption: 15
at java.lang.Integer.parseInt (Integer.j ava:414)
at java.lang.Integer.parseInt (Integer.j ava:454)
the value for prior=15
Thanks,
Muthu
I'm having a problem converting String to int on JavaServer Pages. This is the code I used:
<%
String ss= request.getParameter("prio
int ii = Integer.parseInt(ss);
%>
ii=<%=ii%>
The output i got is
A Servlet Exception Has Occurred
java.lang.NumberFormatExce
at java.lang.Integer.parseInt
at java.lang.Integer.parseInt
the value for prior=15
Thanks,
Muthu
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<%@ page import="java.jang.*, java.io.*" %>
<%
String ss= request.getParameter("prio
int ii = Integer.parseInt(ss);
%>
ii=<%= ii %>
The space is important in <%= ii %>.
Try now!!!