• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:forward vs logic:forward

 
Marco Vanoli
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sweety Ktv
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic