There are several situation, that you can't realise with struts:
*.do
pathes and stores it into a ringbuffer. If the buffer is full, the first entry will be overwritten. So a first struts best practice is forced: Every request must pass the
RequestProcessor
. The second solution can be parameterize with a pattern, so that only a certain pathes will be saved, e.g. only pathes to actions, that are connected to a JSP-site.
Pre*Action
class. So a back has only to keep in mind of those actions. A back from the menu is directed to the
PreEditPersonAction
. If all links are created in such a way the back solution has only keep in mind for request-parameter and not for request attributes, because a back isn't really a back but a "forward into the past".
struts-config.xml
<action path="/back"
type="org.mwolff.struts.back.BackRequestAction"/>
<action path="/forward"
type="org.mwolff.struts.back.ForwardRequestAction"/>
BackRequestProcessor
as a controller:
<controller
processorClass="org.mwolff.struts.back.BackRequestProcessor"
locale="true"
/>
<html:link action="back.do">Go back to last action</html:link>