• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between <forrward> in <action-mappings> and <forward> in <global-forwards>

 
Ranch Hand
Posts: 114
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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".

Thank you.
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
test.jsp:
<html:link forward="logoff"><bean:message key="mainMenu.logoff"/></html:link>

Another example for global forward is:


index.jsp:
<logic:forward name="init"/>

Note: we can get a reference to global and local forward in an action using actionmapping.findforwsrd(String) method.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Global forwards are available across the entire application. "Local" forwards are available only within the action that defines them.
 
Deepaks Deshpande
Ranch Hand
Posts: 114
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Lalit and David.
 
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic