1、jsp的内置对象是指在jsp页面上可以直接使用的对象。有如下9个:
内置对象 | 类型 |
---|---|
out | JspWriter |
request | HttpServletRequest |
response | HttpServletResponse |
session | HttpSession |
exception | Throwable |
page | Servlet(this) |
config | ServletConfig |
application | ServletContext |
pageContext | PageContext |
2、jsp域对象的理解
域对象 | 作用范围 |
---|---|
application | 整个项目 |
session | 一次会话 |
request | 一次请求 |
pageContext | 一个页面 |
3、pageContext作用
(1)域对象-方法
Function() |
---|
setAttribute() |
getAttribute() |
removeAttribute() |
(2)操作其他域对象:xxxAttribute(…,int scope);
其中,scope取值如下:
scope取值 |
---|
APPLICATION_SCOPE |
SESSION_SCOPE |
REQUEST_SCOPE |
PAGE_SCOPE |
(3)获取其他的内置对象:getXxx()
(4)便捷查找:findAttribute(String key):
依次从pagecontext、request、session、application四个域中,查找相应的属性。若查找到了返回值,且结束该次查找;若查找不到,返回一个null