Vita Rara: A Life Uncommon

Mark's Struts 2 Cookbook

Categories: | |

Struts 2 is the new version of Struts, under development at the Apache Group. It is based on WebWork 2, and has many modern web framework features, like user interface tags, type conversion, and validation. Struts 2 is highly flexible and extensible.

In this cookbook you will find HOWTO guides, and recipes for common scenarios in Struts 2.

Displaying action errors, field errors and action messages


I am having 2 different forms pointing to 2 different actions in a single JSP page. Above both the forms we have tags.
The issue is that validation messages (fielderrors and action errors) of form 1 gets displayed above both the forms.

1) For field errors we are using tag having names of form element depending on the form. With this its displaying different field errors. Is this approach correct?

2) What can we do to filter actionerrors?


Could not find a Content-Type for upload

I am not able to get the contents for the csv file but for other files its working fine.

The code is

File Upload Example

in Struts.xml i have placed the below code


uploadsuccess.jsp has


File Upload Example


Can you please tell me how to upload a csv file. I badly need this to be solved. So please help me out

Struts2 and Soap

I hope this is not the absolutely wrong place to ask ... so here goes. Could u point me in the right direction - I would like to build a web app using struts2 and soap. I successfully compiled with maven and appfuse my struts2 and i read abit on apache soap ... but after that where do i go?


cookbook.war ?

It's possible to download directly the cookbook in a war file?

Struts 2 Sample App not deploying in Tomcat 5.5, 6.0

Struts 2 Sample App not deploying in Tomcat 5.5, 6.0

re: how to get it

Click the printer friendly link above and then print it to a PDF. If you don't have a "PDF Printer" there are a number of free ones available that you can download and install.


Printer Friendly View

I have turned on the printer friendly view option.


Install pdfcreator

If you're on windows you can install pdfcreator that basically behaves as a real printer, but outputs pdf files.