JSP Introductory Beginner Tutorial JSP directives

Source: Internet
Author: User

<%@ directive attribute=”value”%>  

Also, you can write multiple properties in one statement:

<%@ directive attribute1="value1" attribute2="value2" attributeN="valueN" %>

There are two main types of directive:

page, which allows you to do something like import classes, define a servlet superclass (superclass),

Mso-hansi-font-family: "" "and so on;

Include, which allows you to insert files into the Servlet class (when the JSP file is translated as a servlet).

First, JSP page directive

Grammar:

<%@ page
[ language="java" ]
[ extends="package .class" ]
[ import="{package .class | .*}, ..." ]
[ session="true|false" ]
[ buffer="none|8kb|sizekb" ]
[ autoFlush="true|false" ]
[ isThreadSafe="true|false" ]
[ info="text" ]
[ errorPage="relativeURL" ]
[ contentType="mimeType [ ;charset=characterSet ]" |
"text/html ; charset=ISO-8859-1" ]
[ isErrorPage="true|false" ]
%>

Page directive mso-hansi-font-family: "" Allows you to define some case-sensitive properties:

(1) Import = "Package.class" or import = "Package.class1,.., package.classn".

Mso-hansi-font-family: "" > >

You can set the packages that you want to import. For example:

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

The Import property is the only one of these properties that can appear multiple times in one JSP.

(2) Contentype = "Mime=type" or contenttype= "Mime-type;charset=character-set" mso-hansi-font-family: "" "

that specifies the MIME type of the output. The default is "text/html". For example:

<%@ page contentType="text/plain" %>"

In Scriptlet is equivalent to:

<% response.setContentType("text/plain"); %>

(3) IsThreadSafe = "true | False. If the value is "true" (the default), the normal servlet processing will be performed and multiple requests will be processed in parallel by a servlet instance, in which case the programmer synchronizes access to multiple instance variables. A value of "false" indicates that the servlet implements single-threaded mode (Singlethreadmodel), providing different detached servlet instances, whether the request is sequential or concurrent.

(4) session= "true | False ". If the value is "true" (the default), the predefined variable session (inherited HttpSession) should be bound to an existing session, or it should be created and bound. A value of "false" means that the session variable will not be used and an error occurs when the JSP converts to the servlet if you attempt to use it.

(5) buffer = "SIZEKB | None ". Determines the size of the buffer for the JspWriter output. The default is set by the server, but at least 8kb.

(6) autoflush= "true | False ". If the value is "True mso-hansi-font-family:" ">" (default), it will automatically empty when the buffer is full, and the value is "false mso-hansi-font-family:" "" > "when the buffer is full and an exception is passed, this is rarely used." When buffer= "None" is false mso-hansi-font-family: "" > value is not legal.

(7) extends= "Package.class". This will generate a superclass for the servlet. Use this feature with special care, because the server may have defined one.

(8) Info = "message". Defines a string that can be obtained by invoking the Getservletinfo method.

(9) ErrorPage = "URL". Specify a JSP mso-hansi-font-family: "" > page to handle any unexpected errors that can be thrown but not handled by the current page.

(a) Iserrorpage = "true | False ". Specifies whether the current page can handle errors from another page, and defaults to "false".

(one) language = "java" mso-hansi-font-family: "". Indicate the language that will be used below. However, it is not necessary to bother with this attribute, because "java mso-hansi-font-family:" ">" is both the default and the only legitimate choice.

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.