You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by torben <to...@frojonck.dk> on 2007/02/28 07:42:42 UTC
Fileupload in JBOSS AS
I have problem to upload a file using strut2 in an jboss server, version
4.0.5
In the jsp page I have:
<s:form action="FileUpload" method="POST"
enctype="multipart/form-data">
<s:file name="FileName" value="Browse..." size="50"
accept="application/vnd.ms-powerpoint"/>
<s:textfield label="User Name" name="username"/>
<s:submit value="Submit"/>
</s:form>
In the strut xml file I have:
<action name="FileUpload"
class="dk.frojonck.action.FileUploadAction">
<result name="success">index.jsp</result>
<result name="error">welcome.jsp</result>
</action>
In the FileUploadAction Class I have:
public class FileUploadAction extends ActionSupport {
....
public String execute() throws Exception {
MultiPartRequestWrapper multiWrapper = null;
HttpServletRequest req=ServletActionContext.getRequest();
multiWrapper=(MultiPartRequestWrapper) req;
....
}
I get the Exception:
java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade
dk.frojonck.action.FileUploadAction.execute(FileUploadAction.java:33)
Can someone give a hint, why I get an instance RequestFacade class
instead of MultiPartRequestWrapper class.
As information I can also mention I am using Securityfilter
(*http://securityfilter*.sourceforge.net/).
Best regards
Torben Frøberg
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Fileupload in JBOSS AS
Posted by torben <to...@frojonck.dk>.
I have found the problem. I forgot to install commons-fileupload and
commons-io.
Torben
torben wrote:
> I have problem to upload a file using strut2 in an jboss server,
> version 4.0.5
>
> In the jsp page I have:
>
> <s:form action="FileUpload" method="POST"
> enctype="multipart/form-data">
> <s:file name="FileName" value="Browse..." size="50"
> accept="application/vnd.ms-powerpoint"/>
> <s:textfield label="User Name" name="username"/>
> <s:submit value="Submit"/>
> </s:form>
>
> In the strut xml file I have:
> <action name="FileUpload"
> class="dk.frojonck.action.FileUploadAction">
> <result name="success">index.jsp</result>
> <result name="error">welcome.jsp</result> </action>
>
> In the FileUploadAction Class I have:
>
> public class FileUploadAction extends ActionSupport {
> ....
> public String execute() throws Exception {
> MultiPartRequestWrapper multiWrapper = null;
> HttpServletRequest req=ServletActionContext.getRequest();
> multiWrapper=(MultiPartRequestWrapper) req;
> ....
> }
>
> I get the Exception:
>
> java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade
> dk.frojonck.action.FileUploadAction.execute(FileUploadAction.java:33)
>
>
> Can someone give a hint, why I get an instance RequestFacade class
> instead of MultiPartRequestWrapper class.
>
> As information I can also mention I am using Securityfilter
> (*http://securityfilter*.sourceforge.net/).
>
> Best regards
> Torben Frøberg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org