Core JSTL[c] Mastering the JSP Standard Tag Library

   

5.3 The <c:redirect> Action

The <c:redirect> action sends an HTTP redirect response to the client and aborts the processing of the JSP page in which the action resides. You can use <c:redirect> to redirect to an external resource or a resource in a foreign context with the following syntax: [5]

[5] Items in brackets are optional. See "<c:redirect>" on page  489 for a more complete description of <c:redirect> syntax.

<c:redirect url [context]/>

As is the case for <c:import>, if you specify the context attribute for <c:redirect>, you must also specify a context-relative URL with the url attribute that points to a resource contained in that foreign context. You can also use <c:redirect> with <c:param> actions with this syntax:

<c:redirect url [context]> <c:param> actions </c:redirect>

Like <c:import>, the <c:redirect> action applies URL rewriting as necessary. See "Redirecting a Response" on page 225 for an example of how you can use <c:redirect>.

   

Категории