当前位置: 代码迷 >> J2EE >> jspsmartupload 出现Files' name is invalid or does not exist
  详细解决方案

jspsmartupload 出现Files' name is invalid or does not exist

热度:966   发布时间:2016-04-22 00:29:23.0
求助 jspsmartupload 出现Files' name is invalid or does not exist !
异常如下。在form中也加了enctype="multipart/form-data"

org.apache.jasper.JasperException: An exception occurred processing JSP page /UpAndDownload/doAdd.jsp at line 25

22: su.setMaxFileSize(filemax);
23: //闄愬埗鏂囦欢涓婁紶绫诲瀷
24: su.setAllowedFilesList(FileListType);
25: com.jspsmart.upload.File file = su.getFiles().getFile(0);
26: ext = file.getFileExt();
27: filelen = file.getSize();
28: if (!file.isMissing()) {


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)


root cause 

java.lang.IllegalArgumentException: Files' name is invalid or does not exist (1205).
com.jspsmart.upload.Files.getFile(Files.java:73)
org.apache.jsp.UpAndDownload.doAdd_jsp._jspService(doAdd_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)



------解决方案--------------------
com.jspsmart.upload.File file = su.getFiles().getFile(0);
建议不要这样写,用个while包起来保险!
还有,可能jsp里出现多个file情况!
------解决方案--------------------
好像是个格式问题
代码迷推荐解决方案:An exception occurred processing JSP page,http://www.daimami.com/search?q=33144
  相关解决方案