| Author |
difference between type and forward???
|
subho saha
Ranch Hand
Joined: Jun 15, 2005
Posts: 57
|
|
I am new to struts. Can somebody explain to me the difference between forward and type attributes of action element in struts-config.xml. In books it is written type is used when we want to use an action and forward when we donot want an action to happen.But i want to know when should i use type and when forward in building a project..They seem to do the same job.What is the actual difference. I am confused.  [ December 18, 2005: Message edited by: subho saha ]
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
My view of this is that in almost every case, you will use Type instead of Forward. Using Type causes struts to call your action before forwarding to a JSP. In a real application, there is almost always some processing you want to do before displaying a JSP. About the only thing I use the forward option for is when I have a simple jsp that requires no setup to display, but I don't really want the user to see xyz.jsp as the url on the browser. So, I set up an xyz action that forwards to xyz.jsp. That way the user sees xyz.do as the url on the browser. [ December 18, 2005: Message edited by: Merrill Higginson ]
|
Merrill
Consultant, Sima Solutions
|
 |
pax smith
Ranch Hand
Joined: Dec 13, 2005
Posts: 45
|
|
Forward simply transfer the control to another JSP without having action class between them Type refres to a action class that will be executed before JSP executes. It performs all the work perior to JSP.
|
 |
 |
|
|
subject: difference between type and forward???
|
|
|