my dog learned polymorphism*
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 best practices ?" Watch "Struts 2 best practices ?" New topic
Author

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?

Regards,
Reghu


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: 460
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: http://jnassef.blogspot.com/
 
 
subject: Struts 2 best practices ?
 
Similar Threads
Tiles advice
.action redirect to .jsp to prevent double submit
TILES - >>> floor or ceiling?
How to pass the URL from the Display tag got due to pagination to a tiles fefinition.
how to catch an exception and do some customized error handling ?