Part of the error is as follows:
HTTP Status 500 - Java. Lang. A NumberFormatException: For input string: ""
Type Exception report
The message Java. Lang. A NumberFormatException: For input string: ""
Description The server encountered an internal error that prevented it from fulfilling this request.
The exception
Javax.mail. Servlet. ServletException: Java. Lang. A NumberFormatException: For input string: ""
Org, apache struts 2. Dispatcher. Dispatcher. ServiceAction (515) the dispatcher. Java:
Org, apache struts 2. Dispatcher. FilterDispatcher. DoFilter (FilterDispatcher. Java: 419)
Root cause
Java. Lang. A NumberFormatException: For input string: ""
Java. The base/Java. Lang. A NumberFormatException. ForInputString (65). A NumberFormatException Java:
Java. The base/Java. Lang. Integer. ParseInt (Integer. Java: 662)
Java. The base/Java. Lang. Integer. ParseInt (Integer. Java: 770)
com. Action. TimuAction. ZiciDafen (timuAction. Java: 94) (feeling problem here)
Java. The base/JDK. Internal. Reflect. NativeMethodAccessorImpl. Invoke0 (Native Method)
Java. The base/JDK. Internal. Reflect. NativeMethodAccessorImpl. Invoke (NativeMethodAccessorImpl. Java: 62
The HTML code is as follows: (the underline is line 94)
Public String ziciDafen ()
{
It request=ServletActionContext. GetRequest ();
Int fenshu=0;
String timuIdList=request. The getParameter (" timuIdList ");
String [] timuIdList1=timuIdList. Split (", ");
for(int i=0; i
String timuId timuIdList1 ;
String timuDaan_user=request. The getParameter (timuId);
[I] String timuDaan=timuDAO. FindById (Integer) parseInt (timuId). GetDaan ();
If (timuDaan equalsIgnoreCase (timuDaan_user))
{
Fenshu +=timuDAO. FindById (Integer) parseInt (timuId). GetFenshu ();
}
}
Enclosing setMessage (" special characters "+ fenshu);
Enclosing setPath (" index. The action ");
Return "succeed";
}
CodePudding user response:
String timuId=timuIdList1;//there is no error? String on the left, right is an array, speculation should be String timuId=timuIdList1 [I];The most simple way to determine if not Numbers continue to type on
for(int i=0; i
String timuId=timuIdList1 [I];
if (! TimeuId. Matches (" ^ \ \ d + $")) continue;//if not numeric types, went into the next cycle