This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 2 best practices ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 best practices ?" Watch "Struts 2 best practices ?" New topic

Struts 2 best practices ?

Reghu Ram Thanumalayan
Ranch Hand

Joined: Oct 21, 2003
Posts: 193
Hello Authors,
A framework can be easily abused if there are no well defined Best practices for the usage. Does the book cover the Struts 2 Best practices in detail?

I have been using Struts 1.2 on a project for a while and there are some things which i still haven't figured out which is the right way to do. For example, a URL leads to a jsp page (a Tiles page to be exact) for input and on page submit, the form is POSTed to a Struts Action. Since i cannot define a struts action path (or rather i don't know how to define) pointing to a tiles definition, i need to define a dummy action class which just redirects to the tiles definition using mapping.findForward. This results in a large number of Action Classes which does nothing but redirects. I guess there should be a better way to do this?


Cheers,<br />Reghu Ram T<br /> <br />SCJP 1.4 - 98 %, SCBCD 1.3 - 94 %, SCMAD 1.0 - 92 %
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 471

You can always have only one dummy action, and use it many times in your struts config with different forwards. Better off, you can use org.apache.struts.actions.ForwardAction which is available in the struts-extras JAR. You can use this action in your struts config, giving the forward path value in the parameter attribute, and do not define any forwards for this action.

Visit my blog:
I agree. Here's the link:
subject: Struts 2 best practices ?
It's not a secret anymore!