Request object Type Javax.servlet.ServletRequest Scope request
Response Response Object Type Javax.servlet.SrvletResponse scope Page
PageContext page Context object type Javax.servlet.jsp.PageContext Scope page
Session object type Javax.servlet.http.HttpSession scope session
Application Application Object type Javax.servlet.ServletContext scope application
Out output Object type Javax.servlet.jsp.JspWriter scope Page
Config configuration object Type Javax.servlet.ServletConfig scope Page
Page object Type Javax.lang.Object Scope page
Exception exception Object type javax.lang.Throwable Scope page
The "Exception" object represents the exception object that is generated by the JSP file runtime, which cannot be used directly in a generic JSP file, but only in a JSP file that uses "<%@ page iserrorpage=" true "%>".
First let's look at the effect:
Judging from the results shown, we can intuitively draw the conclusion that:
The variables in the request can span two pages before and after forward. But as soon as you refresh the page, they recalculate.
The variables in the application keep accumulating until you restart Tomcat, otherwise it will keep getting bigger.
If you put the variable in the PageContext, it means that its scope is page, its valid range is only in the current JSP page.
If you put the variable in the request, it means that it is scoped to request, and its valid range is the current demand period.
If you put the variable in the session, it means that it is scoped to the session, and its valid range is the current one.
If you put the variable in the application, it means that its scope is application, and its effective range is the entire application.
Application The variables in the scope, they survive the longest, and if not manually deleted, they can be used all the time.
Unlike the three above, the variables in the application can be shared by all users. If user A's operation modifies the variable in application, the User B gets the modified value when he accesses it. This will not happen in any other scope, page, request,session are completely isolated, regardless of the modification will not affect other people's data.
JSP nine large built-in objects and four scopes