Three Common JSP compilation commands: jsp compilation commands

Source: Internet
Author: User

Three Common JSP compilation commands: jsp compilation commands

Three Common JSP compilation commands


1. page command

Is the command for the current page


2. include command

Used to specify to include another page


3. taglib commands

Used to define and access custom tags


Common jsp commands

This is what you asked!

Edit nine built-in JSP objects in this section:
Request, response, out, session, application, config, pagecontext, page, exception.
I. request object:
This object encapsulates the information submitted by the user. You can call the corresponding method of this object to obtain the encapsulated information, that is, you can use this object to obtain the information submitted by the user.
Ii. response object:
Send data to the client in a dynamic response to the customer's request.
Iii. session Object
1. What is session: the session object is a JSP built-in object, which is automatically created when the first JSP page is loaded to complete session management.
A session starts when a client opens a browser and connects to the server, and ends when the client closes the browser and leaves the server. When a customer accesses a server, it may connect several pages of the server and refresh a page repeatedly. The server should know in some way that this is the same customer, this requires the session object.
2. session Object ID: when a customer visits a JSP page on the server for the first time, the JSP engine generates a session object and assigns a String-type ID, the JSP engine sends this ID number to the client and stores it in the Cookie, so that the session object and the customer have a one-to-one correspondence relationship. When the customer accesses other pages connected to the server, it will not allocate new session objects to the customer until the client closes the browser, and the session objects of the client on the server will be canceled, and the relationship with the customer's session disappears. When the client re-opens the browser and connects to the server, the server creates a new session object for the client.
Iv. aplication object
1. What is application:
After the server is started, this application object is generated. When the client browses between pages of the accessed website, the application object is the same until the server is closed. However, unlike session, all customers share the same application object.
2. Common Methods for application objects:
(1) public void setAttribute (String key, Object obj): add the Object obj specified by the parameter Object to the application Object, and specify an index keyword for the added Object.
(2) public Object getAttribute (String key): obtains the Object containing keywords in the application Object.
V. out object
An out object is an output stream used to output data to the client. The out object is used to output various types of data.
6. page java. lang. Object
Corresponds to the this keyword. JSP page itself
The page object is an instance of the Servlet class after the current page is converted. From the converted Servlet class code, we can see this relationship:
Object page = this;
In JSP pages, page objects are rarely used.
7. config
Javax. servlet. ServletConfig instance, which represents the configuration information of the JSP. Common methods include getInitPararneter (String paramNarne) and getInitPararneternarnes. In fact, JSP pages do not need to be configured, so there is no configuration information. Therefore, this object is more effective in Servlet.
8. exception
J... the remaining full text>

What are JSP commands?

I will teach you a way to view all jsp commands.

1. Create a jsp page in Eclipse
Second, enter <% @ at the top @
Third: Use the Alt +/combination key

In this way, we can see all the commands in jsp, which are actually three: include, page and taglib.
Page command (define page code, import java class library, etc)
Taglib command (introducing jstl labels)
Include command (import other jsp files)

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.