Title: Merging benefits of Global vs Local forwards

Global forwards are useful if more than one action mapping needs access to the same forward object.  But, if you use a Global forward then you lose the self documenting nature of an action mapping

eg.

<action    path="/editRegistration"
               type="org.apache.struts.webapp.example.EditRegistrationAction"
               name="registrationForm"
              scope="request"
           validate="false">
      <forward name="success"              path="/registration.jsp"/>
</action>

For example, looking at this mapping, it's easy to tell that it can only go to registration.jsp.  So a benefit of using local forwards is it makes it clear where each action mapping can go next.

Is there a standard way of achieving both benefits?  I was thinking of creating an action mapping to wrap the global forward; this would allow an action class to use it as a local forward

eg.

<action    path="/editRegistration"
               type="org.apache.struts.webapp.example.EditRegistrationAction"
               name="registrationForm"
              scope="request"
           validate="false">
      <forward name="success"              path="Registration.do"/>
</action>

Seems like a bit overhead since the Registration.do would have to go through the ActionServlet perform just to forward a jsp.


Is there a better way, maybe having the logical forward mapped to a global forward directly?

Thanks,

Albert



Reply via email to