• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionForward and Forward Action

 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats the difference between ActionForward and ForwardAction ? When do we use ActionForward and when ForwardAction.
Can i say ActionForward is a shorter way of doing the same thing ?
Thanks.
 
Ninad Kulkarni
Ranch Hand
Posts: 802
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
refer this and this

Quote from ForwardAction class

An Action that forwards to the context-relative URI specified by the parameter property of our associated ActionMapping. This can be used to integrate Struts with other business logic components that are implemented as servlets (or JSP pages), but still take advantage of the Struts controller servlet's functionality (such as processing of form beans).
 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know when do we go for ActionForward class and when do we go for ForwardAction. ForwardAction is a StandardAction class in Struts whereas ActioForward is similar to RequestDispatcher ?

Was just wondering why execute has a return type of ForwardAction rather than ActionForward..

Thanks.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jose chiramal wrote: ActioForward is similar to RequestDispatcher ?

No, ActionForward is the decision taken by the RequestDispatcher in order to forward to next resource.
jose chiramal wrote:Was just wondering why execute has a return type of ForwardAction rather than ActionForward..

Do you want to say opposite of it ?
 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry , my mistake should have been "Was just wondering why execute has a return type of ActionForward rather than ForwardAction.."
I find the both very confusing
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, they are confusing, but to make it simple, remember:
1. ActionForward: One which is a return type of Action#execute() method and used by RequestDispatcher.
2. ForwardAction: Dummy (not exactly) action which can be used to delegate to the servlet or any other business logic implementer which can utilize the Struts other functionality, like ActionForm.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic