Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: resonse.sendRedirect() problem


Message #1 by Kapil <subscribaa@y...> on Thu, 3 May 2001 01:45:51 -0700 (PDT)
How about something like this?

<%
data=bean1.getdata()
if (data==null) {
     RequestDispatcher rd 
application.getRequestDispatcher("/errorpage.jsp");
     rd.forward(request, response);
    }
if (data.equals("xyz")) {...} // This causes the exception if data is null
%>

I admit that this is modified from a servlet code, so I've never tried this
type of forwarding inside a JSP. I looked at page 74 in the book for the
info.

Also note that forwarding is different than redirecting.  Redirecting sends
an HTTP message back to the browser, and the browser then requests the new
page.  Forwarding takes place entirely server-side.


  Return to Index