JAVA basics-detailed explanation of JSTL syntax and Parameters

Source: Internet
Author: User
JAVA basics-detailed explanation of JSTL syntax and parameters-general Linux technology-Linux programming and kernel information. The following is a detailed description. JSTL syntax and Parameters

JSTL contains the following labels:

Common labels: for example , , , And so on




Condition Tag: for example , , And so on




URL Tag: for example , And And so on




XML tag: for example And so on




International output tags: for example And so on




SQL Tag: as shown in Figure , , And so on







General purpose labels:

1.

Syntax when no Body exists



Syntax when Body exists



Here is the Body part






Name type description

Expression to be output by value Object

The escapeXml boolean determines the following characters: <,>, &, ', "Whether the string is divided by a number. The default value is true.

Default Object if the result calculated by vaule is null, the default value is output.




2.

This label is used to set a specific value in a certain range (page, request, session, application, etc.) or to set the attributes of an existing javabean object. It is similar to <% request. setAttrbute ("name", "value"); %>

Syntax 1: Use the value attribute to set attributes in a specific range.



Syntax 2: Use the value attribute to set an attribute in a specific range with a Body.



Body section



Syntax 3: Set an attribute of a specific object.



Syntax 4: Set an attribute of a specific object with a Body.



Body section






Name type description

The table to be calculated by the value Object.

Var String is used to indicate the attribute of the value. If you want to use it in other labels, this is done through the value specified by var. It defines a variable in the tag, and this variable can only be one in the tag.

The valid range of scope String var, which can be page | request | session | one of

Target String specifies the object of the attribute. It must be a javabean or java. util. Map object.

The property name of the Target Object to be set in the property Object. For example, if the setan has a name attribute and the setUserId method is provided, enter userId here.




3.






4.

This tag is equivalent to the exception object thrown by the tag inside it.

// Var is the name of the exception

Content






Condition tag

1.

Syntax 1: No Body



Syntax 2: Body



Body content






Name type description

The condition of the test Boolean expression is equivalent to the condition judgment statement in if.

Var String indicates the name of the statement.

Scope String var.




2.

Syntax:

Body content ( And Sub-tag)



Note: its Body can only consist of the following elements:

1) Space

2) zero or multiple Sub-tag, Must be in Before the tag.

3) zero or multiple Sub-tag.




3.

Which indicates Only Used in

Syntax: // Test is of the boolean type and is used to determine whether a condition is true or false.

Body statement






4.

Which indicates . Must appear at the end



Content






Iteration tag

1.

Syntax 1: iteration in Collection



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

Body content






Syntax 2: Fixed iterations.



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

Body content






Name type description

Var String iteration parameter, which is a tag parameter and can be used in other tags to reference the content of this tag.

Items Collection, ArrayList, and items set to be iterated.

Iterator, Map, String,

Eunmeration, etc.

VarStatus String indicates the iteration status. You can access the iteration information.

Begin int indicates the position where the iteration starts.

End int indicates the position of the End iteration.

Step int indicates the Step of iterative movement. The default value is 1.




URL-related tags

1.

Syntax 1: Resource content is exposed externally using a String object



[Var = "varName"] [scope = "{page | request | session | application}"] [charEncoding = "charEncoding"]>

Content






Syntax 2: The content of a resource is exposed to the outside using a Reader object.



VarReader = "varReaderName" [charEncoding = "charEncoding"]>

Content



Name type description

Url String: the URL of the resource to be imported. It can be a relative or absolute path and can be imported to other host resources.

Context String when a relative path is used to access an external context resource, context specifies the name of this resource.

The name of the var String parameter.

Scope String var parameter.

CahrEncoding String indicates the character encoding of the input resource.

The varReader String parameter is of the Reader type and is used to read resources.




2.

Syntax 1: no Body.



Syntax 2: Specify the query parameters in the Body with the Body










3.

Syntax 1: No Body



Syntax 2: Body










Name type description

Value String URL value

Context String when a relative path is used to access an external context resource, context specifies the name of this resource.

Var String identifies the URL scalar.

Scope String variable Scope.




SQL-related labels

1.

2.

3.

4.

5.

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.