ITeye博客

(笔记)JSP中pageContext 与 pageContext.Application_Scope

danielhjd · 2011-03-25 16:30 · J2EE · 编程语言 · JSP · Markdown

[color=red](1)Application_1.jsp[/color] <% String str="hello String"; pageContext.setAttribute("string_1",str); String str1 = (String) pageContext.findAttribute("string_1"); out.println(str1);%> [color=red](2)Application_2.jsp[/color] <%String strr=(String)pageContext.getAttribute("string_1",[color=red]pageContext.APPLICATION_SCOPE[/color]); out.println("get application property:" + strr); %> [color=red](3)Application_3.jsp[/color] <%String str=(String)pageContext.getAttribute("string_1"); out.println(str);%> 三段代码对比 你会发现区别 哈哈!!!! (java还是得多打多敲 哎 :cry: 我不太喜欢 但是一敲了 就想很多 :( 做起来就慢 I am junior, But I want to be Superman...)

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。