首页 > Web开发 > 详细

JSTL核心标签库——重定向URL处理标签、网页导入标签

时间:2018-12-08 18:47:30      阅读:223      评论:0      收藏:0      [点我收藏+]

<c:redirect>重定向标签

  相当于HttpServletResponse的sendRedirect()方法。

技术分享图片
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Hello</title>
</head>
<body>
    <c:redirect url="/home.jsp">
        <c:param name="name" value="${param.name}"></c:param>
        <c:param name="age" value="${param.age}"></c:param>
    </c:redirect>
</body>
</html>
index.jsp
技术分享图片
<%@ page contentType="text/html" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>Home</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
    欢迎 ${param.name} 登陆
</body>
</html>
home.jsp

测试:http://127.0.0.1/home.jsp?name=zs&age=18
响应:欢迎 zs 登陆


<c:url>URL重写标签 

  在用户关闭Cookie功能时,自动用Session ID来进行URL重写。

 

  

JSTL核心标签库——重定向URL处理标签、网页导入标签

原文:https://www.cnblogs.com/Mike_Chang/p/10088575.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!