JSTL c:redirect Core Tag

The JSTL <c:redirect> Core Tag is used to redirect the client’s browser to the specified url. It supports the <c:param> tag.

Syntax:

<c:redirect url=”relUrl” />

c:redirect tag attributes:

Attribute Description Required
url It specify the URL to redirect the user’s browser to. Yes
context / followed by the name of a local web application. No

Example:

test.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


	
		c:redirect JSTL core tag example
	
	
		
	

hello.jsp


	
		c:redirec JSTL core tag example
	
	
		

This is a c:redirec JSTL core tag example.

web.xml


	
  
          test.jsp
  	


Output:

jsp example 42
 
Download this example.
 
Next Topic: JSTL Formatting Tags with example.
Previous Topic: JSTL c:param Core Tag with example.