I am a little puzzled as to what my best option is for mapping and naming actions in the following context.
I have a "posting" form (in JSP) which is used for any of the following: * Posting a new comment * Editing an existing comment * Previewing a new comment * Previewing a comment while it's being edited. I have a DispatchPost action with three methods: newPost(), editPost(), preview(). The form has two buttons: "Post" and "Preview". Clicking "Preview" should call the preview() method (which will forward back to the same JSP). Clicking "Post" should call either the newPost() method or the editPost(), depending on the null-ity of various hidden fields; the JSP form can distinguish internally between those two options. The problem arises with respect to the various security interceptors. A dispatchNewPost action requires a different set of interceptors than a dispatchEditPost action. Therefore, I need to label them separately in struts.xml (interceptors not displayed): <action name="dispatchNewPost" class="com.actions.DispatchPost" method="newPost"/> <action name="dispatchEditPost" class="com.actions.DispatchPost" method="editPost"/> Since the JSP form can distinguish between those two situations, I can wire the appropriate action inside the form. But then, how do I catch the click of the "Preview" button (short of using javascript to modify the form's action)? Say, for instance, that I define the Preview button as follows: <s:form action="dispatchNewPost"> <s:submit value="Post" /> <s:submit value="Preview" method="preview"/> </s:form> What will that Preview button map to? What would be the entry of struts.xml corresponding to that strange combination? (The dispatchNewPost action already points to a method, even before I click on the Preview button...)