Google-sovellukset
Päävalikko

Post a Comment On: lo-fi

"I know why a Struts 2 File Upload fails"

14 Comments -

1 – 14 of 14
Blogger Unknown said...

Good one! These null parameters were pissing me off. :)

4/23/2007 10:52 AM

Blogger Joe said...

many, many, many thanks!

4/29/2007 3:24 PM

Comment deleted

This comment has been removed by a blog administrator.

5/29/2007 9:56 AM

Anonymous Anonymous said...

Hi
thanx its realy a very good one
and its solve my problem

5/29/2007 9:57 AM

Blogger Christian Jensen said...

Thanks a lot!

I am using the JARs from Apache... What is the lightest way to integrate you changes into my app - do I have to go and get full source and rebuild it?

Can you post up a 2.0.6 + fix jar file?

5/29/2007 1:55 PM

Blogger Eric said...

Christian -

The good news is that this is really easy to fix. If you add a fixed FilterDispatcher java file to your own source path for your project, it will override the code in the struts.jar. This is what I do.

No need to build the whole struts from source.

So, you'll add this package to your project:

org.apache.struts2.dispatcher


Then grab the source code for the FilterDispatcher from the repository, after it has been fixed. This one should work:


org.apache.struts2.dispatcher.FilterDispatcher


Then, when you deploy your project, you'll have a fixed FilterDispatcher in your WEB-INF/classes folder, which overrides the one in the struts.jar

5/29/2007 6:26 PM

Anonymous Anonymous said...

Hello! I read this article! Big thanks to author, very interesting. Write more.

9/09/2007 8:26 AM

Blogger Unknown said...

Does this problem exist in S2.0.11?

12/10/2007 3:34 AM

Blogger Eric said...

As far as I know, this problem does not exist since 2.0.7. But, I have not tested file uploads in 2.0.11 yet.

12/10/2007 9:08 AM

Anonymous Anonymous said...

Article is Nice. Iam using Struts 2.0.9. Above mentioned problem didn't exist in that.

2/29/2008 5:49 PM

Anonymous Anonymous said...

I changed the FilterDispatcher class acc. to the one u mentioned. but its not working.. what all versions of jars do i need to take?

9/10/2008 4:22 AM

Anonymous Anonymous said...

after reading the comment from the author i did more research and i found that you can add the following filter / filter mapping in the web.xml instead of overwriting the Dispacth class



filter:
filter-name: struts-cleanup
filter-class: org.apache.struts2.dispatcher.ActionContextCleanUp



filter-mapping:
filter-name:struts-cleanup
url-pattern:/*



This will force struts 2 version 2.0.6 to create a new dispatch instance.

6/22/2009 12:25 PM

Blogger Thamayanthi Karuppusamy said...

Hi,

Currently I am facing same problem in 2.1.8 struts. I am getting all the values as null in action class.

Could you please provide your help to thamayanthi.g@gmail.com

Thanks
Thamayanthi

11/20/2009 4:08 AM

Blogger Valon said...

Thanks very much for your explanation and the Anonymous post re. adding the struts-cleanup filter! File upload seems to be working consistently now with Struts 2.06 (and I now have another reason to upgrade to a later version of Struts 2).

11/07/2010 11:42 AM

You can use some HTML tags, such as <b>, <i>, <a>

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot