Tag <c:redirect> chuyển hướng browser đến URL thay thế, hỗ trợ tự động URL rewriting, context-relative URLs, và tag <c:param>.
Thuộc tính
| Attribute | Description | Required | Default |
|---|---|---|---|
| url | URL chuyển hướng browser | Yes | None |
| context | / theo sau tên web app local | No | Current application |
Ví dụ
Cần truyền tham số cho <c:import>, dùng <c:url> tạo URL trước:
<%@ taglib uri = "https://java.sun.com/jsp/jstl/core" prefix = "c" %>
<html>
<head> <title><c:redirect> Tag Example</title> </head>
<body>
<c:redirect url = "https://www.photofuntoos.com" />
</body>
</html>
Code trên chuyển request đến https://www.photofuntoos.com.