我正在尝试对请求参数“gross”进行类型转换,它抛出了一个数字格式异常。
下面是我的 JSP:
<%
if (request != null) `enter code here`
{
String gross = request.getParameter("gross"); //GROSS PARAM
int grossSal = Integer.parseInt(gross); //Type-Casting
double netSal = 0;
%>
<jsp:useBean id="emp" class="com.source.EmpPOJO" scope="session" />
<jsp:setProperty name="emp" property="id" />
<jsp:setProperty name="emp" property="name" />
<jsp:setProperty name="emp" property="desg" />
<jsp:setProperty name="emp" property="gross" value='<%=grossSal%>' />
<%
netSal = emp.calculateNet();
}
%>