Application:javax.servlet. An instance of ServletContext that represents the Web application that the JSP belongs to, and can be used for JSP pages, or for exchanging information between the servlet.
The common methods are:
GetAttribute (String Attnarne), setattribute (string Attnarne, String attvalue), and Getinitpararneter (string Paramnarne).
Config:javax.servlet. An instance of ServletConfig that represents the configuration information for the JSP. In fact, JSP pages usually do not need to be configured and there is no configuration information. Therefore, the object is more effective in the servlet.
Common methods include Getinitpararneter (String Paramnarne) and Getinitpararneternarnes ().
An instance of exception:java.lang.throwable that represents exceptions and errors in other pages. This object is available only if the page is an error-handling page, that is, the Iserrorpage property of the compile instruction page is true.
The common methods are Getmessageo and Printstacktraceo.
An instance of Out:javax.servlet.jsp.jspwriter that represents the output stream of a JSP page, used to output content, and forms an HTML page.
Common methods:
Out.print ()
Out.newline ()
Out.close (): Turn off output stream
page: Representing the page itself is usually not very useful. This in the servlet, which is the type of the generated servlet
An instance of Pagecontext:javax.servlet.jsp.pagecontext that represents the JSP page context that can be used to access shared data on a page.
The common methods are Getservletcontext () and Getservletconfig ().
Request:javax.servlet. An instance of Http:httpservletrequest that encapsulates a request, and the client's request parameters are encapsulated in the object. This is a commonly used object that must be used to get the client request parameters.
The common methods are
Getpararneter (String Paramnarne), Getpararnetervalues (string paramname), setattribute (String atttibutename,object AttributeValue), getattribute (String attributename) and setcharacterencoding (string env), and so on.
A Response:javax.servlet.http.httpservletresponse instance that represents the server's response to the client. In general, the object is rarely used directly in response, the output response uses an Out object, and the response object is often used for redirection.
Commonly used methods are Sendredirect (J ava.lang.String location) and so on.
An instance of the session:javax.servlet.http.httpsession that represents a session. Starts a session from the client browser when it is connected to the site, until the session is closed when the browser closes.
Common methods are: GetAttribute (string attname), setattribute (string attname, String attvalue), and so on.
The ①out-javax.servlet.jsp.jspwriter out object is used to output the results to a Web page.
Detailed method:
1. void Clear ();
Clears the contents of the output buffer, but does not output to the client.
2. void Clearbuffer ();
Clears the contents of the output buffer and outputs it to the client.
3. void Close ();
Closes the output stream and clears all content.
4. void Flush ();
The data inside the output buffer.
5. int getbuffersize ();
Gets the current buffer size in kilobytes.
6. int getremaining ();
Gets the amount of space that is not occupied in a buffer in kilobytes.
7. Boolean Isautoflush ();
Whether the buffer is automatically refreshed.
8. void newline ();
Output a newline character.
9. void Print (Boolean B);
void print (char c);
void print (char [] s);
void print (double d);
void print (float f);
void print (int i);
void print (long L);
void print (Object obj);
void print (String s);
Outputs the specified type of data to the HTTP stream without wrapping.
10. void println (Boolean B);
void println (char c);
void println (char [] s);
void println (double D);
void println (float f);
void println (int i);
void println (long L);
void println (Object obj);
void println (String s);
Outputs the specified type of data to the HTTP stream and outputs a newline character.
11. Appendable append (char c);
Appendable Append (charsequence cxq, int start, int end);
Appendable Append (charsequence cxq);
Adds a character or an object that implements the Charsequence interface to the back of the output stream.
Members:
int default_buffer = 0-Default buffer size
int No_buffer =-1-writer is in buffered output state
int unbounded_buffer =-2-Limit buffer size
②request-javax.servlet.http.httpservletrequest
The Request object contains all the requested information, such as the source of the request, headers, cookies, and request-related parameter values.
Method:
1. Object getattribute (String name);
Returns the value of the property specified by name, which returns null if the property does not exist.
2. Enumeration Getattributenames ();
Returns a collection of all the property names for the request object.
3. String Getauthtype ();
Returns the name of the authentication method used to protect the servlet and returns NULL when unprotected.
4. String getcharacterencoding ();
Returns the character encoding method in the request, which can be set in the response object.
5. int Getcontentlength ();
Returns the length of the requested body, not 1 when the length is not determined. Can be set in response.
6. String getContentType ();
Returns the type of content defined in response.
7. String Getcontentpath ();
Returns the path of the request.
8. Cookie[] GetCookies ();
Returns an array of all cookies for the client.
9. Enumeration Getheadernames ();
Returns a collection of the names of all HTTP headers.
10. Enumeration Getheaders (String name);
Returns a collection of all values for the specified HTTP header.
11. String GetHeader (string name);
Returns information about the HTTP header for the specified name.
12. Long Getdateheader (String name);
Returns information for the HTTP header of the data type of the specified name.
13. int Getintheader (String name);
Returns information for the HTTP header of the type int of the specified name.
14. ServletInputStream getInputStream ();
Returns the input stream for the request.
15. Locale GetLocale ();
Returns the locale object for the current page, which can be set in response.
16. Enumeration Getlocales ();
Returns a collection of all the locale objects in the request.
17. String Getlocalname ();
Gets the server-side host name of the response request.
18. String getlocaladdr ();
Gets the server-side address of the response request.