What is the difference between <forward> declared in the <global-forwards> tag and <forward> declared in the <action-mappings> tag. Also both the <forward> tags have the same attributes as well. i.e "name" and "path".
Joined: Jun 20, 2005
A global forward is defined in a Struts configuration file and invoked in a JSP page. A local forward is defined in a Struts configuration file in an action mapping and is invoked when the action is invoked.
Following is an example of global forwards in the struts-config.xml file of the struts-example sample application:
The logoff forward is invoked in mainMenu.jsp as follows:
<html:link forward="logoff"><bean:message key="mainMenu.logoff"/></html:link>
Another example for global forward is:
Note: we can get a reference to global and local forward in an action using actionmapping.findforwsrd(String) method.