I'll try to keep this as short as possible. Background: I have various groupings of common events in my web app where I would like each grouping of common events handled by a single Action class. The DispatchAction class allows me to do this. I want to do this because in my scenario, the Action classes are simple proxies to my business tier and are not reusable and I would like to keep the number of Action classes I have to create to a minimum.
Problem: The problem I am running into is that pre-processing requirements vary within the common event groupings. For example, let's say eventGroupA handles events 1, 2, 3, and 4. Events 3 and 4 require that the user be logged in before any processing occurs, but events 1 and 2 don't. An idea: Assertions What if there was a way to declaratively define an ordered list of assertions that must be true before any processing occurs for an action mapping. Assertions would be processed in the order in which they appear in the action mapping and would return an ActionForward only if it failed else it would return null indicating that the assertion passed and to continue processing. Any errors or messages would be revealed to the user via ActionErrors or ActionMessages stored in the appropriate scope. An Assertion would have access to the action mapping so it could leverage lookups for locally or globally defined forwards. An Assertion would implement a Command pattern and have a single method assert() into which the RequestProcessor would be passed the ActionForm, ActionMapping, HttpServletRequest, and HttpServletResponse. Basically the same arguments as Action.execute(). Example struts-config with assertions: <assertions> <assertion name="authenticated" type="com.company.web.assertion.SomeAssertion"/> <assertion name="isAdministrator" type="com.company.web.assertion.AnotherAssertion"/> </assertions> <action path="/user/account/create" type="com.company.web.account.UserAccountController" name="userAccountForm" scope="request" validate="true" input="/WEB-INF/user/account/create.jsp" parameter="create"> <assert name="authenticated"/> <assert name="isAdministrator"/> <forward name="success" path="/WEB-INF/user/account/detail.jsp"/> <forward name="failure" path="/WEB-INF/user/account/error.jsp"/> </action> Example of Assertion.assert(): public ActionForward assert(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception; This solution seems to fit my needs, but I'm interested in any feed back on it. Good or bad. Does it suck? Is there a better way to accomplish my goal? Am I way off track? Am I close? Am I making things too complex? Is this idea kludgy? robert -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>