Jsp job-jsp commands

Source: Internet
Author: User

1. Nine implicit JSP objects (built-in objects)
Request
Response
Session
Application
Config
Page
Exception
Out
PageContext

2. Briefly describe the values of each attribute of the page command.

Import attribute: the unique attribute allowed to appear multiple times in the same document in the page command. Attribute values can be separated by commas.
Convert the jsp page to the package that the servlet should enter. For classes that do not explicitly specify a package, the location of the class package is determined based on the package where the jsp page is located (the directory of the generated servlet. Www.2cto.com
This means that the class will be searched for in the jsp page package.

Make sure to put the Utility Class and bean package in the specified package. Do not rely on automatic import.

Language attributes:
Specifies the script language used in the script element. The default value is java. In jsp2.0 specifications, only java is supported.

ContentType and pageEncodeing attributes:
The contentType attribute sets the MIME type and character encoding of the response header sent to the client document. Separate multiple use; numbers.
The pageEncodeing attribute is only used to change the character encoding.
 
The default MIME type of servlet is text/plain, and the default MIME type of jsp is text/html.
 
Session attribute: controls whether a page participates in a session.

The default value is true. If an existing session exists, the predefined session variable is bound to the existing session. Otherwise, a new session is created and bound to the session.
For high-traffic websites, setting false can save a lot of server memory.
Setting false indicates that a new session is not automatically created. When the jsp page is converted to servlet, access to the variable session leads to an error.
Setting it to false does not disable session tracing. It only prevents users who do not have a session from creating a new session on the jsp page.

* For pages that do not require session tracking, set it to false. When set to false, the session object is inaccessible.

IsELlgnored attributes:
Defines whether to execute or ignore EL expressions on the jsp page. True indicates ignore, and false indicates execution.
The default value depends on the web. xml version. The default value is true before servlet2.3 and false by servlet2.4.
This error occurs when EL expressions are used due to inconsistent JSP versions. Use: isELlgnored = "true ";

Buffer and autoFlush attributes:
The buffer attribute specifies the buffer size used by the out object (JspWriter), in kb. The default value is 8 kb.
None indicates that no buffer is used. In this way, the jsp element that sets the header or status code must appear at the top of the file, before any HTML content.

The autoFlush attribute controls whether to automatically clear the output buffer when the buffer is full (true by default) or throw an exception (false) after the buffer overflow ).
When buffer = none, autoFlush = false is incorrect.
 
Info attributes:
Defines a string that can be obtained through the getServletInfo method in servlet.

The jsp Container generates the getServletInfo method in the servlet and returns the String specified by the info attribute.

ErrorPage and isErrorPage attributes: Specify error pages for specific pages.
The errorPage attribute is used to specify a jsp page to handle any exceptions thrown but not captured on the current page. The specified page can access the exception information through the exception variable.
The isErrorPage attribute indicates whether the current page can be used as an error page of other jsp pages. True or false.
The error page should be placed under the WEB-INF directory, only for server access, does not generate a forwarding call, the client can only see the original request page URL, do not see the error page URL.
 
If you specify an error page for the entire web application or for different types of errors in the application, use the error-page element in web. xml.

If a page defines a specific error page through this attribute, any error pages defined in the web. XML file will not be used.
 
The error object exception can only be used on the error handling page.

IsThreadSafe attribute: This method is replaced by explicit synchronization.
Controls whether the servlet generated by the jsp page allows concurrent access (true by default ).
The implementation of blocking concurrent access is based on the SingleThreadModel interface. Therefore, avoid using the isThreadSafe attribute.
 
Extends attributes: Do not use them. This is what server providers should do. The parent class must be an implementation class for the HttJspPage interface. HttJspPage is a JspPage extension interface applied to HTTP requests and responses.
Specify the servlet superclass generated on the JSP page.

Related Article

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.