You can use the sendRedirect(
String) method on HttpServletResponse (the 'response' implicit object in a JSP) to redirect the client - this sends the HTTP "Temporary Redirect" header, and sets the "Location" (or equivalent) header to the URL passed as the argument to the method.
However, this method will throw an
IllegalStateException if the response has been committed (which normally occurs when the response buffer is flushed for the first time). You therefore need to be extra diligant that nothing has been written to the client before invoking this method.
A better design would see this code inserted into a
servlet rather than a JSP.
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )