A Struts forward is an object that is returned by an action and has two fields: a name and a path. The path indicates where a request is to be forwarded and it is available to all actions.
Difference between Forward and global forward
A forward can be local (for specific action) or global (available to any action).
A forward can be global or local. A global forward is defined in a struts-config.xml file and redirect to a specified JSP page. A local forward is defined in a struts-config.xml file in an action mapping and is invoked when the action is invoked.
Example for Global Forward
<global-forwards>
<forward name="logoff" path="/Applogoff.do"/>
<forward name="logon" path="/Applogon.jsp"/>
<forward name="success" path="/Applogin.jsp"/>
</global-forwards>
Example for Forward
<forward name="failure" path="/passwordError.jsp"/>
<forward name="success" path="/changePassword.jsp"/>
</action>
Difference between Forward and global forward
A forward can be local (for specific action) or global (available to any action).
A forward can be global or local. A global forward is defined in a struts-config.xml file and redirect to a specified JSP page. A local forward is defined in a struts-config.xml file in an action mapping and is invoked when the action is invoked.
Example for Global Forward
<global-forwards>
<forward name="logoff" path="/Applogoff.do"/>
<forward name="logon" path="/Applogon.jsp"/>
<forward name="success" path="/Applogin.jsp"/>
</global-forwards>
Example for Forward
<action path="/changePassword" type="com.bhanuapp.app.security.changePassword" attribute="changePassword" scope="request" validate="true">
<forward name="failure" path="/passwordError.jsp"/>
<forward name="success" path="/changePassword.jsp"/>
</action>
0 comments:
Post a Comment
Please write to us here...