Virendra Talim wrote:
>

> <%
> if(retVal != null)
> { %>
>     <jsp:forward page="<%=retVal%>"/>;
> <%
>     }
> %>
>
> Since this is not a good readable code, try using the sendRedirect method of
> the response object available in the JSP..
>
> <%
> if(retVal != null)
>     response.sendRedirect(retVal);
> %>
>
> Both should work the same way.

No, they don't ! The difference between them is who will do what and on
which side. In the former, sending request to the another resource will
be done on *server* side, so a browser doesn't even know about it. On
the contrary, the later tells a browser to redirect a request to the
another resource. That will be done on client side and involve
*additional* round trip back to a browser. As you can see, be careful
with doing either ways, as they differ.
Another drawback of using sendRedirect is that request's parameters are
lost, so the following page won't see them.

> Viren

Jacek Laskowski

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to