File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes jsp:forward vs logic:forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "jsp:forward vs logic:forward" Watch "jsp:forward vs logic:forward" New topic
Author

jsp:forward vs logic:forward

Marco Vanoli
Ranch Hand

Joined: Jan 12, 2005
Posts: 99
Waht is the difference between to use
<jsp:forward page="default.do"/>
(default.do is an action forward than point to my.jsp )

and

<logic:forward name="welcome"/>

(welcome is a global forward that point to action default.do)

Wich is the right tag to use ?


bye, <br />Marco
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Here are the reference urls:

http://struts.apache.org/userGuide/struts-logic.html#forward

http://java.sun.com/products/jsp/tags/11/syntaxref11.fm9.html

It looks like the main difference is that logic:forward will perform a redirect if you've already written to the output buffer and it's too late to forward.

In my opinion, though, I can't think of a good reason to do a forward from a JSP. The Action class should do the forwarding.


Merrill
Consultant, Sima Solutions
sweety Ktv
Greenhorn

Joined: Jan 11, 2012
Posts: 1
jsp:forward does not check for the path in struts-config.xml, it directly forwarded to the page

logic:forward checks for the name in <global-forwards> of struts-config.xml
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:forward vs logic:forward
 
Similar Threads
Beginner: Action Forward & Global Forward
getting the struts-config.xml reference in JSP
Newbie to struts....help with ActionForward error
sendRedirect
Pop up new HTML page in JSP