日期:2014-05-20  浏览次数:21013 次

错误java.lang.NumberFormatException: For input string: ""
exception 

javax.servlet.ServletException: java.lang.NumberFormatException: For input string: ""
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.yufeng.utils.EncodingFilter.doFilter(EncodingFilter.java:24)

root cause 

java.lang.NumberFormatException: For input string: ""
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
java.lang.Integer.parseInt(Integer.java:468)
java.lang.Integer.parseInt(Integer.java:497)
org.yufeng.struts.action.ArticleAction.admin_add_article(ArticleAction.java:463)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.yufeng.utils.EncodingFilter.doFilter(EncodingFilter.java:24)
我在用jsp编程做一个Struts+Spring+Hibernate文档管理系统,以上错误是在执行上传文件时出现的,具体情况:在admin_add_article.jsp中填写文档信息,点击该页面上传按钮跳转至do_upload.jsp显示上传信息,就是在点击“上传”按钮之后do_upload.jsp无法显示并出现以上错误。
  admin_add_article.jsp
<%@ page contentType="text/html;charset=UTF-8" import="java.util.*,com.jspsmart.upload.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>文章资源管理</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<meta http-equiv="Content-Language" Content="zh-CN">
<meta name="Keywords" Content="">
<meta name="Description" Content="">
<link type="text/css" rel="stylesheet" href="/yf_article/Style/Style.css">
<Script Language="JavaScript" src="Include/Function.js"></Script>
<Script Language="JavaScript" src="Include/PopText.js"></Script>
<Script Language="JavaScript" src="Include/jquery.js"></Script>
<Script Language="JavaScript" src="Include/verify.js"></Script>
<Script Language="JavaScript">
function addar(){
if(document.Admin_Article.ar_name.value==""){
alert("文章标题不能为空!");
return false;
}
}
</script>


</head>
<body bgcolor="#FFFFFF" leftMargin="10" topmargin="10">
<form name="Admin_Article" method="post"
action="article.do?method=admin_add_article&ar_id=${article.ar_id }"