I think the problem is just that you need to add the following parameter
inside your html form:
enctype="multipart/form-data" 
and then the cast should work.



red phoenix-2 wrote:
> 
> In http://struts.apache.org/2.0.14/docs/how-do-we-upload-files.html , it
> use
> MultiPartRequestWrapper multipartRequest = (MultiPartRequestWrapper)
> ServletActionContext.getRequest();
> It still raise java.lang.ClassCastException:
> org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be cast to
> org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper.
> My popuse is that when jsp sumbit to action,I can get upload file name and
> the stream of upload file,then I can write the stream of upload file into
> blob of oracle database.I don't know how to get the stream of upload file!
>  I still puzzled with why raise above error. I don't find the different
> between my code and
> http://struts.apache.org/2.0.14/docs/how-do-we-upload-files.html.
> 
> Where wrong with my code?
> 
> 
> 
> 
> On Tue, Dec 16, 2008 at 11:13 PM, Dave Newton <newton.d...@yahoo.com>
> wrote:
> 
>> --- On Tue, 12/16/08, red phoenix wrote:
>> > [...]
>> > MultiPartRequestWrapper multipartRequest =
>> >     (MultiPartRequestWrapper) ServletActionContext.getRequest();
>> > [...]
>> >
>> > org.apache.struts2.dispatcher.StrutsRequestWrapper cannot be cast to
>> > org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper
>> >
>> > Why raise above error?
>>
>> Because StrutsRequestWrappers can't be cast to MultiPartRequestWrappers.
>>
>> > How to correct it?
>>
>> Use the built-in file upload capabilities of Struts 2; there's no reason
>> to
>> access the request manually.
>>
>> Here's that link again:
>>
>> http://struts.apache.org/2.0.14/docs/how-do-we-upload-files.html
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/org.apache.struts2.dispatcher.StrutsRequestWrapper-cannot-be-cast-to-org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper-tp21034825p21630535.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to