What's the best/proper way to create a HTML:form whose "action" property is set to whatever action caused the jsp template containing it to be displayed in the first place?
For example, suppose a form submission to /admin_action.do triggers an action class (say, "AdminAction") which determines that the user needs to log in before doing whatever it was that his original form submission was supposed to achieve. As luck would have it, the form bean just submitted was a subclass of the login form bean (in fact, ALL of the application's form beans are subclasses of the login form bean so they'll be capable of doing double-duty as a login form bean while preserving the state of the remaining formvars during a login sidetrip should the need arise). Anyway, the action class returns mapping.findForward("login"), which is mapped to /templates/login.jsp. No sweat. Here's where things get sticky. The action class above ("AdminAction") is not the only one that might plausibly return mapping.findForward("login"). Actually, every single action class (including "AdminAction" above) is a subclass of the abstract LoggedInUserAction class, which verifies that the user is logged in (and/or tries to log them in, if a username and password happens to have been submitted) before calling its own performLoggedInAction() abstract class, and returns mapping.findForward("login") if the user needs to log in. In other words, form submissions to /admin_item.do, /admin_preview.do, /admin_something_else.do, and numerous other URLs map to Action classes that are subclasses of LoggedInUserAction, any of which might plausibly result in the return of mapping.findForward("login") if LoggedInUserAction realizes that the user hasn't logged in. The challenge is making sure that when login.jsp gets displayed because /admin_preview.do fell through to login.jsp, the submitted login form gets sent to /admin_preview.do. If login.jsp gets displayed because /admin_item.do fell through to login.jsp, the submitted login form should get sent to /admin_item.do. I know I -could- create a separate login form for every possible action, but I'm pretty sure that there's GOT to be a better way to do it. Like maybe a scripting variable whose value is whatever URL resulted in the display of the current page? Suggestions? sample struts.xml excerpt: <form-beans type="org.apache.struts.action.ActionFormBean"> <!-- all three form beans are subclasses of LoginFormBean --> <form-bean name="createForm" type="pkg.CreateFormBean"> <form-bean name="previewForm" type="pkg.PreviewFormBean"> <form-bean name="updateForm" type="pkg.UpdateFormBean"> </form-beans> <global-forwards type="org.apache.struts.action.ActionForward> <forward name="peon" path="/not_allowed.jsp"> <!-- when the "login" mapping is called, it needs to use whatever bean --> <!-- was associated with the original action in the action-mappings below --> <forward name="login" path="/login.jsp"> </global-forwards> <action-mappings type="org.apache.struts.action.ActionMapping"> <action path="/create" type="pkg.CreateAction" name="createForm"> <forward name="create" path="/create.jsp"> </action> <action path="/preview" type="pkg.PreviewAction" name="previewForm"> <forward name="preview" path="/preview.jsp"> </action> <action path="/update" type="pkg.UpdateAction" name="updateForm"> <forward name="update" path="/update.jsp"> </action> </action/mappings> sample login.jsp excerpt: <html:form action="/create.do"> <!-- assuming this jsp was displayed as a result of a form submission to /create.do. If the form submission resulting in this page's display were to /update.do, the action needs to be "/update.do", and so on. Perhaps something like... --> <%-- <html:form action="<%=URL_from_which_the_display_of_this_page_was_launched%>"> --%> </html:form> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>