JSP file elements

xiaoxiao2021-03-06  69

Template element

a. Refers to the static HTML / XML content

2. Notes

N html Note: Display Note in Client ] ->

n Hide Note: Write in the JSP program, but do not send it to the customer <% - Commnet -%>

3. Script elements

a. Declaration

n declaration is to declare legitimate variables and methods in the JSP program

EG.1-1

<%! String getdate ()

{

Return new java.util.date (). tolocalestring ();

}

INT count = 10;

%>

b. expression (Expression)

N expressions are code between <% = and%>.

c. scriptlets

N is located between <% and%>. It is a legal Java code.

4. Instruction element

a. Page instruction

N format <% page attention = "value" ...%>

Attributes

description

Defaults

example

Language

Define the scripting language to use, can only be "java"

Java

Language = "java"

Import

Like the general Java Import, use "," separately open bags or class lists

By default ignore

Import = "java.io. *, javax.servlet.jsp. *"

session

Specify whether this page is involved in an HTTP session

True

session = "true"

Buffer

Specifies the buffer mode to the customer output stream. If it is none, it is not buffered. If the value is specified, then the output is buffer.

Not less than 8K, set according to different servers

Buffer = "64kb"

AutoFlash

When the TRUE buffer is full, the client output is refreshed; the FALSE buffer is full, there is an exception, indicating the buffer overflow.

True

AutoFlash = "true"

Info

For information on the JSP page, define a string, you can use servlet.getServletInfo ()

By default ignore

INFO = "a test page"

Iserrorpage

Indicates whether the current page is an ErrorPage target for other pages. If set to TRUE, you can use the Exception object. Instead, if set to false, you cannot use an Exception object.

False

iSerrorPage = "false"

ErrorPage

Define the page that calls an abnormality in this page

By default ignore

ErrorPage = "Error / Error.jsp"

Isthreadsafe

It is used to set whether the JSP file can be used multithreaded. If set to True, a JSP can handle a request for multiple users at the same time; the opposite can only process one user.

True

iStreadsage = "True"

Contenttpye

Define the MIME type of JSP character encoding and page response.

TYPE = TEXT / HTML

Charset = ISO8859-1

Contemttype = "text / html; charset = GB2312"

PageEncoding

Character encoding of JSP page

PageEncoding =

"ISO-8859-1"

PageEncoding = "GB2312"

ISelignored

Whether the EL (Expression Language) is ignored, if true, the container ignores the computing default value of the "$ {}" expression is determined by the version of the web.xml description file, and the previous version of servlet2.3 will ignore.

iSelignored = "True"

b. Include Directive

n For files that contain text or code, this containment process is static.

n format: <% @ include file = "filename"%>

c. taglib instruction

n This instruction allows the page user to customize the label. The content here does not understand, put it behind

D. Expression language

N JSP2.0 new technology, you can simplify JSP development, use "$ {}" to represent

N $ {sessionscipe.test} is equivalent to Session.GetaTribute ("test")

The specific content is unclear, placed behind

5. The action element action element works in the request processing phase. When the container is processed JSP, each of this action element is performed according to his tag, a common action element.

a.

n To provide additional information for other tags.

N how to use:

b.

n Allows static or dynamic resources in the ready-made JSP page in the request time. The object being included only has access to the JSPWriter object and cannot set the head or cookie. If the page output is buffered, the refresh of the buffer is better than the included refresh.

n format:

(here Flush can only use TRUE)

c.

n allows the request to be forwarded to another JSP, servlet, or static resource file.

n format

(Page is a value or a string, orienting a file or URL)

d.

N and Usebean collaborate together to set the simple properties of Bena and index properties.

n

n where PropertyDatails has four different ways:

1. Property = "*"

2. Property = "PropertyName" param = parameteraname

3. Property = "PropertyName"

4. Property = "PropertyName" Value = PropertyValue Note: You cannot use Param and Value at the same time in one . e.

n Supplements for the , used to access a bean properties. Its access to the attribute value converts it into a string and then sent to the output stream. If the attribute is an object, the toString () method will be called.

N How to use:

1.

EG:

n Limit: You cannot use to check the properties that have been indexed. This place does not understand

f.

n To create a bean instance in the JSP page, and specify his name and its scope.

n syntax:

N TypeSpec can use the following four:

1. Class = "classname"

2. Class = "classname" type = "typename"

3. Beanname = "beanname" type = "typeename"

4. TYPE = "TypenAme"

g.

h.

转载请注明原文地址:https://www.9cbs.com/read-119615.html

New Post(0)