I use struts2.0.14,I want to use upload function,my jsp file is follows:
<s:form enctype="multipart/form-data" method="post">
<s:file name="upload" label="File" accept="text/*" cssStyle="width:260px"/>
...
<s:form>

struts action is follows:
public String uploadFile() throws Exception{
    MultiPartRequestWrapper
multipartRequest=((MultiPartRequestWrapper)ServletActionContext.getRequest());

    ...
    return SUCCESS;
}

when I submit jsp to action,it raise following error:
java.lang.ClassCastException:
org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be cast to
org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper

Why raise above error? How to correct it?

Any idea will be appreciated!

Reply via email to