Implied object of the JSP:
A set of objects that can be used directly without the need for new.
Tomcat is created automatically and can only be used in expression script <%=%> and normal script <%%>.
1, request "key"
Type: javax.servlet.http.HttpServletRequest
Methods: Request.getparameter ("txtUserName");
Request.setcharacterencoding ("GBK");
Request.setattribute (String, Object)
Request.getattribute (String);
Request.getsession (TRUE);
Request.getrequestdispatcher ("/url-pattern");
Request.getcookies ();
2, session "key"
Type: javax.servlet.http.HttpSession
Method: Session.getid ()
Session.setattribute (String, Object)
Session.getattribute (String)
Session.removeattribute (String)
Session.invalidate ()
Start: Session begins when client issues a JSP request for the 1th time
End: Timeout, invalidate ()
3, Response
Type: Javax.servlet.http.HttpServletResponse
Methods: Response.setcontenttype ("text/html");
Response.getwriter ();
Response.setcharacterencoding ("GBK");
Response.sendredirect ("/web Application name/url-pattern");
4, out
Type: Javax.servlet.jsp.JspWriter
Method: Out.print ()//to IE print
OUT.PRINTLN ()//To IE print, add line wrap in source code
Out.write ()//to IE print, usually user print constant
5, Application
Type: Javax.servlet.ServletContext
Method: Application.getinitparameter ("name");
Application.setattribute (String, Object)
Application.getattribute (String)
Application.removeattribute (String)
6, page
Type: Java.lang.Object
Represents the current JSP page, can be understood as this,jsp is a special servlet class, generate JSP page also generates the corresponding servlet instance. The page represents the current Servlet object instance and is not normally used.
7, Config
Type: Javax.servlet.ServletConfig
8, exception
Type: java.lang.Throwable
You can only use the JSP in the <%@ page iserrorpage= "true"%>.
9, PageContext
It's a PageContext object, PageContext is a jspcontext subclass.
1 Other 8 hidden objects can be obtained
JspWriter o = pagecontext.getout ();
2 scope (JSP in a total of 4 scope objects, from small to large: PageContext, request, session, application)
A page in the current request
Type: Javax.servlet.jsp.PageContext
Method: Pagecontext.setattribute (String, Object);
Pagecontext.getattribute (String);
3 can access named properties in the other 3 scopes
Search for named properties specified from 4 scopes from small to large, stop
Method: Pagecontext.findattribute (String);//jspcontext inside the method
Get named property from specified scope
Pagecontext.getattribute ("name", Pagecontext.application_scope)
4) Include/forward
JSP four scoping objects
Pagecontext,request,session,application
Servlet Three Scope objects
Request,session,application
Four scope objects in El
Pagescope,requestscope,sessionscope,applicationscope