For example this will work
<@include page="test2.jsp"/>
<jsp:forward page="test3.jsp"/>
or
<jsp:forward page="test3.jsp"/>
<jsp:include page="test2.jsp"/>
<jsp:forward page="test3.jsp"/>
<jsp:forward page="test3.jsp"/>
But once you have dsp:include in page, you will not be able to redirect to any other page using any redirection operation like "Redirect" droplet or "jsp:forward" or request dispatcher etc.
For example:
test1.jsp
<%@ taglib uri="dsp" prefix="dsp"%>
<dsp:page>
I am in test1.jsp <br>
<%-- including test2.jsp --%>
<dsp:include page="test2.jsp"/>
<%-- redirect to page test3.jsp --%>
<dsp:droplet name="/atg/dynamo/droplet/Redirect">
<dsp:param name="url" value="test3.jsp"/>
</dsp:droplet>
end of test1.jsp <br>
</dsp:page>
test2.jsp
<dsp:page>
I am in test1.jsp <br>
<%-- including test2.jsp --%>
<dsp:include page="test2.jsp"/>
<%-- redirect to page test3.jsp --%>
<dsp:droplet name="/atg/dynamo/droplet/Redirect">
<dsp:param name="url" value="test3.jsp"/>
</dsp:droplet>
end of test1.jsp <br>
</dsp:page>
<%@ taglib uri="dsp" prefix="dsp"%>
<dsp:page>
I am in test2.jsp <br>
</dsp:page>
test3.jsp
<dsp:page>
I am in test2.jsp <br>
</dsp:page>
<%@ taglib uri="dsp" prefix="dsp"%>
<dsp:page>
I am in test3.jsp <br>
</dsp:page>
if you access http://localhost:8080/test1.jsp<dsp:page>
I am in test3.jsp <br>
</dsp:page>
output -
I am in test1.jsp
I am in test2.jsp
end of test1.jsp
If you remove " <dsp:include page="test2.jsp"/>" in test1.jsp andI am in test2.jsp
end of test1.jsp
access http://localhost:8080/test1.jsp
you will be redirected to test3.jsp
I am in test3.jsp
If you use jsp:include or @include instead of dsp:include like below
<jsp:include page="test2.jsp"/>
<dsp:droplet name="/atg/dynamo/droplet/Redirect">
<dsp:param name="url" value="test3.jsp"/>
</dsp:droplet>
You will be redirected to test3.jsp. <dsp:droplet name="/atg/dynamo/droplet/Redirect">
<dsp:param name="url" value="test3.jsp"/>
</dsp:droplet>
Thanks for the tip, I'm unaware of this till this date. Will keep in mind! Thanks!
ReplyDeleteEven i am too not aware of this, Thank you for the information.
ReplyDeletevery good one....very userfull when ve perform transient check in profile....Redirection droplet
ReplyDeleteyes kavi..
Deletevery nice pls update these type of small defects in the future
ReplyDeleteSaved my day !!
ReplyDeleteThis comment has been removed by the author.
ReplyDeletebut when we have prams to send to other page jsp:include is not working . can you please help out.
ReplyDelete< jsp:include page="/account/gadgets/review-item-link.jsp" >
< jsp:param name="productId" value="${orderLine.itemStyle}" />
< /jsp:include>
Suffered half a day today because of this.
ReplyDelete