浏览 138 次
|
该帖已经被评为新手帖
|
|
|---|---|
| 作者 | 正文 |
|
时间:2008-05-03 关键字: spring
1. create a bean to implements the ServletContextAware, and spring will automatically set the servletContext:
public class ApplicationScopeObjectSettings implements ServletContextAware { ServletContext servletContext; public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; servletContext.setAttribute("appScope", "appScope" + (new java.util.Date())); } } 2. in xml file: <bean id="ApplicationScopeObjectSettings" class="ApplicationScopeObjectSettings"/> 3. Then you can access the appScope in application scope in your jsp page. 声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |


