---
title: "(笔记)JSP中pageContext 与 pageContext.Application_Scope"
author: "danielhjd"
date: "2011-03-25T16:30:15Z"
tags: ["JSP"]
categories: ["编程语言"]
slug: "jsp-pagecontext-pagecontext-application-scope"
draft: false
lastmod: "2011-03-25T16:30:15Z"
id: 975425
url: "https://danielhjd.iteye.com/blog/975425"
---

\[color=red](1)Application\_1.jsp\[/color] &lt;% String str="hello String"; pageContext.setAttribute("string\_1",str); String str1 = (String) pageContext.findAttribute("string\_1"); out.println(str1);%&gt; \[color=red](2)Application\_2.jsp\[/color] &lt;%String strr=(String)pageContext.getAttribute("string\_1",\[color=red]pageContext.APPLICATION\_SCOPE\[/color]); out.println("get application property:" + strr); %&gt; \[color=red](3)Application\_3.jsp\[/color] &lt;%String str=(String)pageContext.getAttribute("string\_1"); out.println(str);%&gt; 三段代码对比 你会发现区别 哈哈！！！！ （java还是得多打多敲 哎 :cry: 我不太喜欢 但是一敲了 就想很多 :( 做起来就慢 I am junior, But I want to be Superman...）