请教下jsp上传文件,没有用struts2标签html页面使用 file form有 enctype属性 只要选择文件就报错
<formmethod=“post”action="uploadaction"enctype="multipart/form-data">页面标签<inputtype="...
<form method=“post” action="uploadaction" enctype="multipart/form-data" >
页面标签<input type="file" name="uploadImg" /> 多文件上传
action:
private File[] uploadImg;
private String[] uploadName;
private String[] uploadImgFileName;
private String[] uploadImgContentType;
struts.xml中也设置了存放文件的临时目录
运行时只要选择了文件 就报错。
报错信息:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [byishenAction]
org.apache.struts2.convention.ConventionsServiceImpl.determineResultPath(ConventionsServiceImpl.java:100)
org.apache.struts2.convention.ConventionUnknownHandler.determinePath(ConventionUnknownHandler.java:385)
org.apache.struts2.convention.ConventionUnknownHandler.handleUnknownResult(ConventionUnknownHandler.java:274)
com.opensymphony.xwork2.DefaultUnknownHandlerManager.handleUnknownResult(DefaultUnknownHandlerManager.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:226)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:367)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
.......
cause by
java.lang.ClassNotFoundException: byishenAction
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
org.apache.struts2.util.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:111)
org.apache.struts2.convention.ConventionsServiceImpl.determineResultPath(ConventionsServiceImpl.java:98)
org.apache.struts2.convention.ConventionUnknownHandler.determinePath(ConventionUnknownHandler.java:385)
org.apache.struts2.convention.ConventionUnknownHandler.handleUnknownResult(ConventionUnknownHandler.java:274)
com.opensymphony.xwork2.DefaultUnknownHandlerManager.handleUnknownResult(DefaultUnknownHandlerManager.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:226)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:367)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
..........
注意:form的action 输入错误了 应该是 byishenAction 。不好意思。请问该如何解决此问题? 展开
页面标签<input type="file" name="uploadImg" /> 多文件上传
action:
private File[] uploadImg;
private String[] uploadName;
private String[] uploadImgFileName;
private String[] uploadImgContentType;
struts.xml中也设置了存放文件的临时目录
运行时只要选择了文件 就报错。
报错信息:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [byishenAction]
org.apache.struts2.convention.ConventionsServiceImpl.determineResultPath(ConventionsServiceImpl.java:100)
org.apache.struts2.convention.ConventionUnknownHandler.determinePath(ConventionUnknownHandler.java:385)
org.apache.struts2.convention.ConventionUnknownHandler.handleUnknownResult(ConventionUnknownHandler.java:274)
com.opensymphony.xwork2.DefaultUnknownHandlerManager.handleUnknownResult(DefaultUnknownHandlerManager.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:226)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:367)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
.......
cause by
java.lang.ClassNotFoundException: byishenAction
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
org.apache.struts2.util.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:111)
org.apache.struts2.convention.ConventionsServiceImpl.determineResultPath(ConventionsServiceImpl.java:98)
org.apache.struts2.convention.ConventionUnknownHandler.determinePath(ConventionUnknownHandler.java:385)
org.apache.struts2.convention.ConventionUnknownHandler.handleUnknownResult(ConventionUnknownHandler.java:274)
com.opensymphony.xwork2.DefaultUnknownHandlerManager.handleUnknownResult(DefaultUnknownHandlerManager.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:226)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:367)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
..........
注意:form的action 输入错误了 应该是 byishenAction 。不好意思。请问该如何解决此问题? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询