Common attributes of page commands in jsp

Source: Internet
Author: User

Common attributes of page commands in jsp

1. language attributes

Sets the language used for jsp pages. Currently, only java is supported. The default value is java.

 

<%@ page language=java %>

2. extends attributes

 

Sets the java class inherited from the jsp page. Before execution, the jsp page is parsed into a Servlet by the server, and the Servlet is defined by the java class, therefore, both jsp and Servlet can inherit the specified parent class. This attribute is not commonly used and may affect server performance optimization.

 

3. import attributes

Set the JSP imported class package. The embedded java code snippet needs to import the corresponding class package.

 

<%@ page import=java.util.* %>

4. pageEncoding attributes

 

Specify the page encoding format, if set to ISO-8859-1, the page does not support Chinese, usually set to GBK or UTF-8

 

<%@ page pageEncoding=GB18030%>

5. contentType attributes

 

Set the MIME type and encoding of the page

 

<%@ page contentType=text/html; charset=UTF-8%>

 

 

6. session attributes

Specifies whether the page uses an HTTP session object. The default value is true.

 

<%@ page session=true%>

 

 

7. buffer attributes

Set the buffer size of the out output object on the page. The default value is 8 KB. The unit is KB only. We recommend that you use a multiple of 8 as the attribute value.

 

<%@ page buffer=128kb%>

8. autoFlush attributes

 

Sets whether to automatically refresh the cache when the page cache is full. The default value is true. If it is set to false, an exception is thrown when the cache is full.

 

<%@ page autoFlush=false%>

 

9. isErrorPage attributes

You can set the current page as an error handling page to handle errors on another JSP page, that is, an exception handling page.

 

<%@ page isErrorPage=true%>

10. errorPage attributes

 

Set the exception handling page of the current page. The isErrorPage of the corresponding exception handling page must be set to true. If this attribute is set. any error handling page defined in the xml file will be ignored, and the exception handling page defined by this attribute will be used first.

 

<%@ page errorPage=error/registerErrorPage.jsp%>


 


 

 

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.