JSP PageContext. Getattribute () method: retrieves the attribute within the specified range
•
Java
getAttribute(String name,int scope)
Example
<% pageContext.getAttribute("user",pageContext.SESSION_SCOPE); %>
Typical application
<body> <% pageContext.setAttribute("date",new Date()); //将信息保存在pageContext对象中 pageContext.setAttribute("author","C语言中文网"); out.println("系统时间为:"+pageContext.getAttribute("date")+"<br>"); //将信息显示在页面中 out.println("作者为:"+pageContext.getAttribute("author")); %> </body>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码