Vita Rara: A Life Uncommon

What would you want in a Struts 2 cookbook?


I'm seriously considering writing a dead tree Struts 2 cookbook. What types of recipes would you like to see? Beyond what is already in my cookbook I've been thinking of the following:

  • Integration with other tools:
    • Spring & Spring MVC
    • Hibernate, iBatis, JPA
    • JSF (integration and migration)
    • Guice
    • SiteMesh
    • Others?
  • Architecture
    • Using "modules" to break up a large project
    • Using layers
    • Using Spring as architectural glue
  • Working with OGNL
  • Working with the S2 UI Tags
    • Creating a new tag integrated with OGNL and the ValueStack
    • Using S2 UI components
    • Styling S2 UI components
    • A better version of the multicolumn layout theme
    • Creating better forms and handling errors and their presentation
    • Presenting tabular data for presentation and editing
  • Struts 1 Integration & Migration
    • Running Struts 1 and Struts 2 side by side
    • Creating a Maven build environment for Struts 1 & 2, using XDoclet
    • Migrating Struts 1 Actions to Struts 2
  • i18n
  • Interceptors
    • Creating an interceptor
    • Packaging an interceptor as a Struts 2 Plugin
    • Solving cross cutting concerns with Interceptors
  • Extending Struts 2
    • Creating a packaging a S2 plugin with Maven
    • Adding scripting support to S2 (ala Groovy Works)
    • Automatic scaffolding using a plugin, like Rails and Grails
  • Using Struts 2 with various build environments
    • Maven
    • Ant
    • Various IDEs
  • Validation
    • Using XML based validation
    • Using the Validateable interface
    • Handling complex semantic validation
    • Creating pluggable validators with Spring
  • Security, Login and User Management
    • Integrating with JAAS
    • Rolling your own simple authentication system
    • Creating a pluggable authentication system with IoC
    • Securing an action based on user role
    • Securing part of a page with JSP tags
    • Integrate with Acegi
  • View Layer Integration
    • What's a result?
    • Using results to generate different types of output
    • Integrating different result types, such as
      • Jasper Reports
      • Velocity
      • FreeMarker
      • Groovy Server Pages
      • Tiles
    • Creating a custom result types
    • Post and redirect result type
  • Struts 2 and Ajax
    • Help me here. I'm not an Ajax guy yet.

Please reply with what you'd like to see. All ideas are welcome.

Struts 2 With Jasper Report Creation

Need a sample Application of Struts 2 with integrating Jasper Report using tomcat 5.5.
If anyone has plz reply me with src code and db script.

Advenced topics - extending struts

I woud like to learn more about advenced topics especially

  • Creating a new tag integrated with OGNL and the ValueStack
  • Adding scripting support to S2 (ala Groovy Works)
  • Integrate with Acegi

I want 2 see ina struts2 book!

A tutorial for beginerrs as introduction about the 3 frameworks integration would be fantastic.


FOR ECLIPSE winter 3.3

In my opinion

An exciting feature of Struts 2 is configuration-free plugins. Third-party components can be added to the framework just by putting a JAR on the Java classpath. In fact, many of the framework's advanced features are provided by plugins that ship with Struts 2. A plugin repository site is open to the public [8], and several plugins are already available, including plugins for JSON, WebFlow, Google Web Toolkit, and Guice.

Struts 2 and Plugins

I'm agree that plugins are a great feature of Struts 2. If I end up doing a book coverage of plugins will be a large part of it.



Because I am going to make CMS in Struts 2 this would be something I would love to see there. It would be greate if you will have in your cokebook this kind of application so you can teach everything you want on some practical and real application.

Complex Validation!

I would like to see an article on complex validation. The basic validaotrs included with Struts do not do enough. I want to know best practices for writing your own validators. How should we write validators that need database data to validate?

Yes, I would like to. No I'm

Yes, I would like to. No I'm seeking solution for validation in ui and service layer without duplication of code ;>

Struts 2 XSLT

Hi Mark,

I would really like to see some tutorials concerning Struts XSLT. Everyone is into JSF and all these new things and XSLT is shamefully neglected. There are still a lot of reasons to use it and Struts 2 obviously has support for it. A simple example was easy to set up, but I could not figure out from documentation how to change the XML stream that is being generated. How do I register my own Adapter? The documentation says I need to call a particular register method in AdapterFactory, but it does not explain where in my code I have access to the AdapterFactory instance. Unfortunately I could not get any help on the mailing list or elsewhere in the web nor could I find the examples mentioned somewhere in the Javadoc. No one seems to be using these great XSLT features... Why? Can you help or even provide a tutorial?

Kind regards

Another one...

Oh yes, I forgot: In real life you have existing projects. Often it is not a valid option to migrate to Struts completely. As I looked at Struts 2 I have the impression that it allows for much easier integration with existing projects than the preceding versions. However there is a lack of best practices and examples for integrating with existing projects. What are the issues you have to consider when integrating into an existing project? Which steps need to be taken?

Furthermore: What I find difficult about frameworks such as Struts is the configuration aspect. If documentation lacks here it is always hard to figure out how it is supposed to work. And often documentation ends where it gets exciting... so this is something I would like to see being dealt with more detailed - accompanied with example code.

BTW It's great that the code used in your tutorials can be downloaded on your page. Keep up the great work!


As with any book like this, what I want to see most, is clear, useful examples that actually work.

I just started using Struts 2, and have found that much of the existing documentation suffers in this either, either having no examples, incomplete examples, or examples that are simply incorrect.


It is my intent that all of the examples be runnable, and also available as an open source download.

Tiles integration

I would like to see some examples on tiles and parameter passing from tiles to struts tags etc., the ognl examples I see are very few and dont give me an idea of how to access attributes passed into tiles.

Tiles integration

Thanks. I don't use tiles, but this should be in there.


Spring webflow of course ! :)
I would add something about performance ...


Got it. These are good ideas.


How about helping out on the

How about helping out on the Struts 2 wiki instead - save a tree ! ;-)



Struts 2 Wiki

Hi Phil,

First I have no real aversion to helping out on the Wiki. Though to be honest I personally find it easier to write on my own Blog.

As regards a book I've always wanted the challenge of writing a book. I also think having some Struts 2 books on the shelves lends credibility to the framework.


Struts 2 Cookbook

Hi, thank you for site and your helpfull tricks.

I'd like to see those recepies :
- Security, login and user management (own simple authentication system, pluggable authentication system, securing an action based on user role) ;
- View Layer Integration (Jasper report) ;
- Integration with Hibernate ;
- Using Struts 2 with various build environments (Ant) ;
- i18n ;
- Working with the S2 UI Tags (Creating a new tag integrated with OGNL and the ValueStack, Styling S2 UI components) ;
- Architecture (Using "modules" to break up a large project, Using layers) ;