Originally posted by Brent Sterling:
I have been involved with 3 or 4 Struts based projects and all of them have interjected a common base class for actions, though I am sure there are plenty of projects that do not use this approach. The basic idea is that you create a base class that extends Action. Your base class implements the execute method (I have it declared final). In your base class' execute method you perform common processing (stuff like checking that the user is valid, retrieving data needed for common tiles, logging, and exception handling). Your execute method would then call an abstract method with a name like doExecute (you can pick whatever name you want). Now all your action classes would extend your base class instead of Action.
Now to your questions:
1) The action would only be called if the initial validation performed by the validator framework passed, so I don't see how it would interfere.
2) I am not sure what you are asking. You could probably perform this validation in the form's validate method but I would rather not call business method or make database calls from my form.
3) see above
4) Do you mean processError? This method exists in my common action base class.
- Brent
Don't get me started about those stupid light bulbs. |