JSP built-in object--application,page,pagecontext,config,exception

Source: Internet
Author: User

Application Object
The Application object implements the sharing of user data and can store global variables.
The application starts at the start of the server and terminates at the server shutdown.
You can manipulate the same property of a Application object in a user's back-and-forth link or in a connection between different users.
At any point in the operation of application object properties, soy milk affects other users ' access to this.
The startup and shutdown of the server determines the life of the Application object.
The Application object is an instance of the ServletContext class.
Common methods are as follows:
void SetAttribute (String name,object value) binds an object to this session using the specified name.
Object GetAttribute (String name) returns the objects that are bound together with the specified name in this drawing, and returns null if no object is bound under that name.
Enumeration Getattributenames () returns an enumeration of all available property names
String Getserverinfo () returns the JSP (Servlet) engine name and version number

Page Object
The Page object refers to the current JSP page itself, a bit like the this pointer in the class, which is an instance of the Java.lang.Object class. Common methods are as follows:
Class GetClass () returns the classes of this object
int Hashcode () returns the hash code of this object
Boolean equals (Object obj) to determine whether this object is equal to the object specified
void copy (object obj) copies this object to the specified object
Object Clone () clones this object
String toString () converts the object object to a String class
void Notify () wakes up a waiting thread
void Notifyall () Wakes all waiting threads
void Wait (int timeout) causes a county to wait until the timeout is over or is awakened
void Wait () is a county in a waiting state to know to be awakened

PageContext Object
The PageContext object provides access to all objects and namespaces within a JSP page
The PageContext object can access the session contained on this page, or it can take a property value of the application
The PageContext object is equivalent to the synthesizer of all the features in the page
The class name of the PageContext object is also called PageContext.

Config object
The Config object is used by the JSP engine to pass information to it when a servlet is initialized, including the parameters to be used when the servlet initializes (through property names and property values) and information about the server (by passing a ServletContext object). Common methods are as follows:
Servletcontet Getservletcontext () returns ServletContext object containing information about the server
String Getinitparameter (string name) returns the value of the initialization parameter
Enumeration Getinitparameternames () returns an enumeration of all parameters required by the servlet initialization

Exception Object
The exception object is an exception object that is generated when an exception occurs during a page run. If a JSP page is to be applied to this object, the Iserrorpage must be set to true, otherwise it cannot be compiled. He is actually the object of java.lang.Throable, the usual method is as follows:
String GetMessage () returns a message describing the exception
String toString () returns a short description message for Guan Yu's exception
void Printstacktrace () shows exceptions and their stack traces

JSP built-in object--application,page,pagecontext,config,exception

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.