Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: Fileupload in JBOSS AS

torben

2007-03-05

Replies:

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@(protected)
> For additional commands, e-mail: user-help@(protected)
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.