page作用域,指本JSP页面的范围

下列是testOne.jsp页面代码:
<%
    String name = "page";
    pageContext.setAttribute("name",name);
%>
<strong> 
    testOne:<%=pageContext.getAttribute("name") %>
</strong>
<br/>
<%
    pageContext.include("testTwo.jsp");
%>
下列是testTwo.jsp页面代码:
<strong> 
    testTwo:<%=pageContext.getAttribute("name") %>
</strong>
页面输出:testOne:page      testTwo:null

猜你喜欢

转载自blog.csdn.net/javaChengXuY/article/details/81783251