-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
在jsp页面可以直接使用application对象, 在servlet中却不能直接使用,
这如何是好呢?在servlet 中使用application方法如下:
this.getServletContext().setAttribute("user","123456");
--------------------------------------------------------------------------------------------
注:在servlet中
this.getServletContext()返回的就是application对象
本文探讨了在JSP页面与Servlet中如何正确使用Application对象。特别指出,在Servlet中可通过getServletContext()方法来获取并设置全局应用范围内的属性。
636

被折叠的 条评论
为什么被折叠?



