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?
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.