javaWeb four domain objects are described in detail

  • 2020-05-17 05:29:09
  • OfStack

javaWeb 4 large domain objects

1) methods related to properties

Object getAttribute(String name)

 

获取指定的属性

Enumeration getAttributeNames()

 

获取所有的属性的名字组成的Enumeration对象

void removeAttribute(String name)

 

移除指定的属性

void setAttribute(String name, Object o)

 

设置属性

2) domain objects with the above attribute methods

The scope of pageContext, request, session, application ranges from small to large

pageContext                         

属性的作用范围仅限于当前jsp页面,在servlet中无法获取该对象

request

属性的作用范围仅限于同1个请求,主要用于请求转发

session

属性的作用范围仅限于1次会话,从浏览器打开直到关闭称为1次会话(在此期间会话没失效),在servlet中通过request对象获取

application

属性的作用范围限于当前WEB应用,是范围最大的属性作用范围,只要在1处设置属性,在其他各处的jsp或servlet中都可以获取到,在servlet中对应于ServletContext对象

Thank you for reading, I hope to help you, thank you for your support of this site!


Related articles: