Question
How can I use common forward for all actions. I mean I don't want to write common forward in all actions.
<forward name="invalidlogin" path="/invalidlogin.jsp" />
I don't want to write this in all <Actions>
.
Solution
It sounds like you're just describing a global forward. Global forwards are defined in the struts-config.xml file. That way, the forward is defined for all actions so any action can use the forward.
So you would place something like the following in your struts-config.xml file:
<global-forwards>
<forward name="error" path="jsp/error.jsp"/>
</global-forwards>
Then just forward to "error" in your action class:
return mapping.findForward("error");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow