Three jsp compilation commands-page, include (page, include, taglib)

Source: Internet
Author: User

The page command is usually at the top of the jsp page. Multiple page commands can be used on a jsp page. The syntax format of the page command is as follows:

 

<% @ Page

[Language = "java"]

[Extends = "package. class"]

[Import = "package. class | package. *,..."]

[Session = "true | false"] (sets whether HTTP Session is required for this page)

[Buffer = "none | 8kb | size kb"] (specify the size of the output buffer, in kb)

[AutoFulsh = "true | false"] (whether to force the output buffer content when the output buffer is about to overflow. True --- normal output)

[IsThreadSafe = "true | false"]

[Info = "text"] (set the information of the JSP program, which can also be seen as its description. You can use Servlet. GetServlet () method to obtain this value. If you are on the JSP page, you can directly call getServlet (0 method to obtain this value. Because the JSP page is essentially a Servlet)

[ErrorPage = "relativeURL"]

[ContentType = "mimeType [; charset = characterSet]" | "text/html; charSet =" ISO8859-1 "]

[IsErrorPage = "true | false"]

%>

 

 

<! -- Specify info -->

<% @ Page info = "this is a jsp" %>

<HTML>

<HEAD>

<TITLE> test the info attribute of the page command </TITLE>

</HEAD>

<BODY>

<! -- Output info -->

<% = GetServletInfo () %>

</BODY>

</HTML>

 

After execution, the page travel information is "this is a jsp" (the same as <% @ page info = "this is a jsp" %>)

 

 

 

 

(INCLUDE command)

The include command can be used to embed an external file into the current JSP file, and parse the JSP statement on this page (if any ),

This is a static include statement that includes other compilation commands on the target page. But dynamic include does not.

<% @ Include file = "relativeURLSpec" %> (relative address), as shown in <% @ include file = "hehe. jsp" %>

If the embedded file needs to change frequently, we recommend that you use the <jsp: include> Operation Command.

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.