The study of page in JSP

Source: Internet
Author: User

Page is the property used to define the entire page

Page properties: ContentType, import, language, session, buffer, AutoFlush, IsThreadSafe, pageencoding

Format: <%@ page Property 1 = "Property value 1", "Property value 2" Property 2 = "Property value"%>

One property specifies multiple attribute values when the property value is quoted, and the attribute values are separated by commas (punctuation English)

Space between multiple properties of the page

Langusge property: Only the Java language can be specified at this time.

Format: <%@ page language= "java"%>

The property value of language is "Java" by default, that is, even if the language property is not used, the default is <@ page language= "java" >

Import property: Used to invoke core packages in Java

Format: <%@ page import= "java package"%> For example: <%@ page import= "java.io.*", "Java.util.Date"%>

You can call more than one package at a time, with commas between different packages.

(Note: You should know the core packages commonly used in Java)

ContentType properties: Determining the appropriate type and character encoding for JSP pages

Format: <%@ page contnettype= "type; encoding"%>

Example: <%@ page contenttype= "text/html;charset=gb2312"%>

Common types of ContentType are: text/html, Text/plain, Image/gif, Image/x-xbitmap, Image/jpeg, Image/pjpeg, application/ X-shockware, Application/vnd.ms-powerpoint, Application/vnd.ms-excel, Application/msword, etc.

Common contenttype encoding values are: gb2312, UTF-8, etc.

Session Properties: Set whether a built-in session object is required

The usual session values are: True and false, which is false by default.

Buffer property: The built-in input stream object out is responsible for sending some information or running results of the server to the client display, the buffer property is used to specify the size of the buffer for out setting or not to use, set out with none without using a buffer. The default is 8KB.

Format: <%@ page buffer= "24KB"%>

AutoFlush Property: Specifies whether the buffer is automatically refreshed when the out buffer is filled.

The common AutoFlush property values are: True and false. The default is true. If set to False, an overflow exception occurs if the buffer is filled, and the value of AutoFlush cannot be set to False when the property value of buffer is set to none.

IsThreadSafe Property: Sets whether the Web page can be accessed multithreaded.

Common IsThreadSafe Property values: True and False. If set to true can simultaneously multi-person access, if set to False, when a user at the time of access, other users can not access, only in the queue waiting.

Info property: Defines a commonly used cut string that may be frequently modified

Format: <%@ info= "string"%>

For example: <%@ info= "We are student"%>

The Getservleinfo () method is used in the JSP page to obtain the value of info.

The study of page in JSP

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.