The JSTL Core Tag is used to redirect the client’s browser to the specified url. It supports the tag.
Syntax:
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" %>
<html>
<head>
<title>c:redirect JSTL core tag example</title>
</head>
<body>
<c:redirect url="/hello.jsp"/>
</body>
</html>
|
hello.jsp
<html>
<head>
<title>c:redirec JSTL core tag example</title>
</head>
<body>
<h3>This is a c:redirec JSTL core tag example.</h3>
</body>
</html>
|
web.xml
<web-app>
<welcome-file-list>
<welcome-file>test.jsp</welcome-file>
</welcome-file-list>
</web-app>
|
Output:
No comments:
Post a Comment