Don't you have a submit button in your form? I think so ... As the submit button has a property name just simply check for that request parameter ... if you get a null the form was not submitted to reach that action ...
The real question is: do you really need an action class to display the page with the form? So lets have two actions: one to display the page and the second to do the form handling. a) action mapping for first action does just a simple forward to the jsp page ... if you need later an action to prepare anything change the forward to an type to invoke processing though an struts action. In any case you can prevent validating the form through a boolean flag without action class <action path="/actions/showUserPasswordPage" forward="/pages/showForm.jsp" name="changePasswordForm" scope="request" validate="false"> </action> <action path="/actions/setUserPassword" type="test.PrepareView" name="pp_changePasswordForm" scope="request" validate="false"> <forward name="next" path="/pages/showForm.jsp"/> </action> b) the form handling by an action class after successfull form validation <action path="/actions/setUserPassword" type="test.SetUserPasswordAction" name="changePasswordForm" scope="request" validate="true" input="/pages/showForm.jsp"> <forward name="next" path="/pages/showAnything.jsp"/> </action> Don't forget to design the validate method of the form bean ... - Christian -----Original Message----- I tend to use the same Action class for doing any preprocessing prior to displaying the form (e.g. for populating any beans used by the form) and also for processing the form input. I distinguish between a fresh request to display the form and a form submission, by putting a hidden field in the form (I call it 'fromForm'). That way, my action class can determine whether a request came from the form or not. Not sure if this is best practice, but I know of no other way. Hopefully someone else has a better solution...? Lindsay -----Original Message----- From: adam kramer [mailto:[EMAIL PROTECTED]] Sent: 19 August 2002 21:43 To: [EMAIL PROTECTED] Subject: [MVC-Programmers] Action Redirection I'm programming a tomcat-struts application and trying to follow a true MVC architecture. I'd like some suggestions on best practices or standards for calling up/naming actions for are passthroughs for blank html forms for adding business entities (e.g. adding a application user). In the Struts catalog (http://www.husted.com/struts/catalog.htm) the 'Link only to Actions' item says "If a JSP ends up on your browser's address bar after the initial index page, then you're missing an Action ;-)" If I want to link to a blank form (not populated) for adding a user to my web application, what are some best practices/standards for setting this up in my struts-config.xml action mappings? 1) I don't want to validate the form yet, just show the jsp page so they can fill it out and then submit. 2) I can't call this action something like /user/Add because that will be the submit action for this form. (this is a naming problem) 3) I can't just link to addUser.jsp because that would be breaking my MVC purity. My issue is basically with configuration organization. Any help is greatly appreciated. Thanks, Adam _______________________________________________ MVC-Programmers mailing list [EMAIL PROTECTED] http://www.netbean.net/mailman/listinfo/mvc-programmers _______________________________________________ MVC-Programmers mailing list [EMAIL PROTECTED] http://www.netbean.net/mailman/listinfo/mvc-programmers _______________________________________________ MVC-Programmers mailing list [EMAIL PROTECTED] http://www.netbean.net/mailman/listinfo/mvc-programmers