Schaub, Stephen wrote the following on 7/11/2005 2:07 PM:

public class SimpleAction extends Action { public ActionForward
execute( ActionMapping mapping, ActionForm form, HttpServletRequest
request, HttpServletResponse response) throws Exception { SimpleActionForm bean = (SimpleActionForm)form; return
bean.execute(mapping, request, response); } }

You can do that, although I still like my business logic done higher up in the Action (Servlet) that I submit to rather than having it be done in the Object that is backing the view (your ActionForm subclass). Michael Jouravlev on this list does this and his stuff looks very nice if you want to take this approach.


With this approach, most JSP pages could have a single Java class --
a SimpleActionForm subclass that handles both validation and
processing for the page:

Well they certainly wouldn't have a 'single' java class, you would have a LOT of them. I can have one ActionForm (if I wanted) for my entire application but you will definitely have many of them to process the business logic. You mean you'll have 'one' java class that is extended. I don't see the big deal of that since Struts has the same concept.. your ActionForms extend a flavor of the ActionForm base class.

public class LoginForm extends SimpleActionForm {  private String
username; private String password;  ... getter and setter methods ...


public abstract ActionForward execute( ActionMapping mapping, HttpServletRequest request, HttpServletResponse response) throws
Exception { ... Login processing ... }   public ActionErrors
validate(ActionMapping mapping, HttpServletRequest req) { ...
validation code ... }

}

I don't think you meant for that to be abstract. But notice you know have an execute in all your ActionForms? How is that different than simply the processing done in different Actions as Struts is now? All you've done is pushed down the processing to a different place.. ActionForm vs Action.

Then, in my struts-config.xml file, most form beans would extend the
SimpleActionForm, and most actions would use the SimpleAction type:

<form-beans> <form-bean name="loginform" type="LoginForm" /> <!--
extends SimpleActionForm --> </form-beans>

Ok, yes they'd have to extend that in order to utilize your processing in the ActionForm functionality. Bottom line is I think all you've done is move where you do the processing... you moved it from the Actions to the ActionForms. If you like this approach definitely check out StrutsDialog. (Sorry Michael, not trying to oversimplify all that your stuff does, I realize it's much more than processing in the ActionForm, but if he's going to do this he might as well stand on the shoulders of someone who has done all the work already:)

--
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to