Friday, October 15, 2010

JSP Introduction and examples show



JSP technology is Java language as a scripting language, JSP pages for the entire server-side Java library module provides an interface to serve HTTP applications. JSP to Java code and certain pre-defined actions can be embedded into a static page. JSP syntactical increased movement known as the JSP XML tags, they used to call the built-in functions. In addition, you can create a JSP tag library, and then as a standard HTML or XML tags, like to use them. Provides a tag library and platform-independent method of expansion server performance.

JSP compiler JSP is compiled into Java Servlets. A JSP JSP compiler can compile code written in JAVA servlet and then by the JAVA compiler to compile into machine code,

Can be directly compiled into binary code.

Example:

test


JSP Standard Tag Library and the introduction of the EL expression language

JSP Standard Tag Library (JSP Standard Tag Library, JSTL) is a Web application to achieve a common feature common custom tag library collection, these features include

Iteration and conditional, data management format, XML manipulation and database access.

EL provides some identifiers, access devices and operators, used to retrieve and manipulate the presence of data in the JSP container.

JSTL syntax and parameters

JSTL contains the following labels:

Common label: such as,, etc.

Conditions of tags: if,, etc.

URL Tags: If, and so on

XML tags: if so

International Export Tags: As, etc.

SQL Tags: If,, etc.

General-purpose tag:

1.

When there is no syntax Body



When a syntax Body



Here is the Body Part



Name Type Description

value Object to be output expression

escapeXml boolean :<,>,&,'," the following characters in the string to determine whether the dividend, the default is true

default Object if the vaule calculated result is null, then the output of the default values

2.

This tag is used in a range of (page, request, session, application, etc.) use a name to set a specific value, or set an existing

javabean object. He is similar to

Grammar 1: use value property to set a specific range of properties.



Syntax 2: Use the value attribute to set a specific range of properties, and with a Body.



Body parts



Syntax 3: Set a property of a specific object.



Syntax 4: Set a property of a specific object, and with a Body.



Body parts



Name Type Description

value Object to be calculated in the table to type.

var String used to represent the value of the property value, if you want to use other labels, that is, the value specified by the var carried out. It is equivalent to the definition of a label

Variables, and this variable is only a label.

scope String var effective range, which can be page | request | session | application of a

target String object properties to be set, it must be javabean or the java.util.Map object

property Object to be set in the Target object property names, such as javabean have a name attribute provides a setUserId method, then fill userId here

.

3.



4.

This tag is equivalent to capture the label inside it throws the exception object

/ / Var is the name of abnormal

Content



Condition tag

1.

Syntax 1: without Body condition



Syntax 2: Body of the situation



Body Content



Name type description

test Boolean expression of conditions, the equivalent of if () in the conditional statement.

var String name, said the statement.

scope String var the variable scope.

2.

Syntax:

Body content (and sub-labels)



Note: It's Body only by the following elements:

1) spaces

2) 0 or more sub-label, the label must appear before.

3) 0 or more sub-tags.

3.

Represents a conditional branch, only the use of

Syntax: / / test is a boolean type, used to judge the conditions of true and false

Body statement



4.

Represents the final choice. Appear to be in the final



Content



Iteration Tags

1.

Syntax 1: In the Collection of iteration

[Begin = "begin"] [end = "end"] [step = "step"]

Body Content



Syntax 2: a fixed number of iterations.

[Begin = "begin"] [end = "end"] [step = "step"]

Body Content



Name Type Description

var String iteration parameters, it is the label parameter, through which the other label to refer to the contents of this tab.

Items Collection, ArrayList, iteration of the items to the collection.

Iterator, Map, String,

Eunmeration etc.

VarStatus String that the state of iteration, iteration can access their own information

Begin int iterations that start position.

End int position that end of the iteration.

Step int said moving step iteration, the default is 1.

URL-related tags

1.

Syntax 1: Resource String object using the content of external exposure

[Var = "varName"] [scope = "(page | request | session | application)"] [charEncoding = "charEncoding"]>

Content




Syntax 2: Resources for the content of external exposure using the Reader object.

varReader = "varReaderName" [charEncoding = "charEncoding"]>

Content




Name Type Description

url String to be imported resources, URL, can be a relative path and absolute path, and other host resources can be imported

When using a relative path context String context to access external resources, context specifies the name of this resource.

var String parameter names.

scope String var parameter coverage.

cahrEncoding String input resources of character encoding.

varReader String this parameter's type is Reader, for reading resources.

2.

Syntax 1: No Body's situation.



Syntax 2: Body circumstances specified in the query parameters Body







3.

Syntax 1: No Body



Syntax 2: Body







Name Type Description

value String URL value

When using a relative path context String context to access external resources, context specifies the name of this resource

var String scalar identify the URL.

Scope String variable scope.

SQL related tags

1.

2.

3.

4.

5.

Example:

To judge success
$ (Bl) test


JSP Introduction to here.

[Var = "varName"]>







Recommended links:



Real to MP4



Never fight a battle unprepared



ASP script timeout problem when running the ultimate solution



Illustrator9.0 and GOLIVE5.0



AVI to MPEG4



LAPTOPS82



PLM on the 411



QT to WMV



Domestic long road CAXA CAD lead the way down to earth



Specialist Web Development



Fireworks Produced way back in effect



Yu Zhicheng: How scientific orientation 3G problems



Evaluate Terminal And Telnet Clients



CMM assessment in China Suggestions



3DS Max 7 Mental Ray renderer whole strategy: global illumination



No comments:

Post a Comment