JSTL - Core <c:redirect> Tag


Advertisements

The <c:redirect> tag redirects the browser to an alternate URL by facilitating automatic URL rewriting, it supports context-relative URLs, and it also supports the <c:param> tag.

Attribute

The <c:redirect> tag has the following attributes −

Attribute Description Required Default
url URL to redirect the user's browser to Yes None
context / followed by the name of a local web application No Current application

Example

If you need to pass parameters to a <c:import> tag, use the <c:url> tag to create the URL first as shown below −

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

<html>
   <head>
      <title><c:redirect> Tag Example</title>
   </head>

   <body>
      <c:redirect url = "http://www.photofuntoos.com"/>
   </body>
</html>

The above code will redirect request to http://www.photofuntoos.com - Try it yourself.

jsp_standard_tag_library.htm

Useful Video Courses


Video

JSP, Servlet, JSLT + Hibernate: A complete guide

108 Lectures 11 hours

Chaand Sheikh

Video

Full Stack Java developer - Java + JSP + Restful WS + Spring

Best Seller

517 Lectures 57 hours

Chaand Sheikh

Video

Servlets and JSP Tutorial For Beginners!

41 Lectures 4.5 hours

Karthikeya T

Video

JSP and Servlets - The Complete Course

42 Lectures 5.5 hours

TELCOMA Global

Video

JSP and Servlets Bootcamp: Web Applications for Beginners

15 Lectures 3 hours

TELCOMA Global

Video

JSP (Java Server Pages) Certification Training

44 Lectures 15 hours

Uplatz

Advertisements