做了一个JSP上传页面,但是有错误(用JSPSmartupload做的) 20
用JSPSmartupload包做了一个上传页面但是浏览器一直抱错。浏览器报错信息如下:typeExceptionreportmessagedescriptionThes...
用JSPSmartupload包做了一个上传页面但是浏览器一直抱错。
浏览器报错信息如下:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /test.jsp:15
12:
13:
14: int fileCount=theSmartUpload.save(savePath) ;
15: theSmartUpload.upload() ;
16: out.println("成功上传文件数目:"+fileCount ) ;
17:
18: %>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NegativeArraySizeException
com.jspsmart.upload.SmartUpload.upload(SmartUpload.java:218)
org.apache.jsp.test_jsp._jspService(test_jsp.java:66)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs
页面代码如下:
%@ page contentType="text/html; charset=GB2312" language="java" %>
<%@ page pageEncoding="GB2312" %>
<%@ page import="com.jspsmart.upload.*" %>
<jsp:useBean id="theSmartUpload" scope="request" class="com.jspsmart.upload.SmartUpload"/>
<%
theSmartUpload.initialize(pageContext) ;
theSmartUpload.setTotalMaxFileSize(5*1024*1024) ;
String savePath = "C:\\saveDir\\" ;
int fileCount=theSmartUpload.save(savePath) ;
theSmartUpload.upload() ;
out.println("成功上传文件数目:"+fileCount ) ;
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>测试上传</title>
</head>
<body>
<form action="test.jsp"
enctype="multipart/form-data"
name=theFile method="post" >
<input type=file name=File1 size=50 /> <br>
<input type=submit name=submitButton value="上传" />
</form>
</body>
</html> 展开
浏览器报错信息如下:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /test.jsp:15
12:
13:
14: int fileCount=theSmartUpload.save(savePath) ;
15: theSmartUpload.upload() ;
16: out.println("成功上传文件数目:"+fileCount ) ;
17:
18: %>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NegativeArraySizeException
com.jspsmart.upload.SmartUpload.upload(SmartUpload.java:218)
org.apache.jsp.test_jsp._jspService(test_jsp.java:66)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs
页面代码如下:
%@ page contentType="text/html; charset=GB2312" language="java" %>
<%@ page pageEncoding="GB2312" %>
<%@ page import="com.jspsmart.upload.*" %>
<jsp:useBean id="theSmartUpload" scope="request" class="com.jspsmart.upload.SmartUpload"/>
<%
theSmartUpload.initialize(pageContext) ;
theSmartUpload.setTotalMaxFileSize(5*1024*1024) ;
String savePath = "C:\\saveDir\\" ;
int fileCount=theSmartUpload.save(savePath) ;
theSmartUpload.upload() ;
out.println("成功上传文件数目:"+fileCount ) ;
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>测试上传</title>
</head>
<body>
<form action="test.jsp"
enctype="multipart/form-data"
name=theFile method="post" >
<input type=file name=File1 size=50 /> <br>
<input type=submit name=submitButton value="上传" />
</form>
</body>
</html> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询