JSP的域对象的作用范围

<%--
  Created by IntelliJ IDEA.
  User: tT丶
  Date: 2017-12-12
  Time: 14:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>域对象</title>
</head>
<body>
    <%
        pageContext.setAttribute("PageContext","value11111111111");
        request.setAttribute("Request","value2222222222");
        session.setAttribute("Session","value333333333333");
        application.setAttribute("Application","value44444444");
    %>
    <!--html注释-->
    <%--jsp注释--%>

    1.<%=pageContext.getAttribute("PageContext")%>
    2.<%=request.getAttribute("Request")%>
    3.<%=session.getAttribute("Session")%>
    4.<%=application.getAttribute("Application")%>
</body>
</html>

 

posted @ 2017-12-12 15:43  云晴  阅读(723)  评论(0)    收藏  举报