JSTLsyntax and ParametersL
Jstl contains the following tags:Commonly used tags: such as <c:out>, <c:remove>, <c:catch>, <c:set> and other conditions of the label: such as <c:if><c:when>, <c: Choose>, <c:otherwise> and other URL tags: such as <c:import>, <c:redirect> and <c:url> XML tags: such as <xml:out> such as international output tags: such as <fmt:timeZone> SQL Tags: such as <sql:query>, <sql:update>, <sql:transaction> and so on L
General purpose Label:1. <c:out> Grammar with no body <c:out value= "value" [escapexml= "{true|false}"] [default= "DefaultValue"]/> Grammar with body <c:out value= "Value" [escapexml= "{true|false}"]> This is the body section </c:out> name Type description value Object is going to output the expression EscapeXML b Oolean determines the following characters: <,>,&, ', ' is divisor in the string, default is true if the result of Vaule is null, then output this default value
2. <c:set> This tag is used to set a particular value in a range (page, request, session, application, etc.), or to set the properties of an existing JavaBean object. He is similar to <%request.setattrbute ("name", "value");%> Syntax 1: Use the Value property to set a property in a specific range. <c:set value= "value" var= "VarName" [scope= "{page|request|session|application}"]/> Syntax 2: Use the Value property to set a property in a specific range, And with a body. <c:set var= "VarName" [scope= "{page|request|session|application}"]> body section </c:set> Syntax 3: Sets a property for a particular object. <c:set value= "value" target= " Target "property=" PropertyName "/> Syntax 4: Sets a property of a particular object with a body. <c:set target= "Target" property= the "propertyname" > Body section </c:set> name type describes the table-to-style that value Object will evaluate. var StringThe property that is used to represent the value, if it is to be used in another label, is through the value specified by this var. It is equivalent to defining a variable in the label, and this variable can only be one of the tags. The valid range of scope String var can be a target string in page|request|session|application the object that will set the property, it must be JavaBean or Java.util.Map object Property object in the target object to set the name of the attribute, such as in the JavaBean has a Name property, provides a Setuserid method, then fill in the UserID here.
3. <c:remove><c:remove var= "VarName" [scope= "{page|request|session|application}"]/>
4. <c:catch>This tag is equivalent to capturing the exception object that the tag inside it throws <c:catch [var= "VarName"]>//var is the exception's name content </c:catch> L
condition Label1. <c:if>Syntax 1: No body situation <c:if test= "testcondition" var= "VarName" [scope= "Page|request|session|application" ]/> Syntax 2: The case of the body <c:if test= "testcondition" var= "VarName" [scope= "Page|request|session|applicat" Ion "]> Body Content </c:if> name type describes the condition of the test Boolean expression, which is equivalent to the conditional judgment statement in the IF (). The Var String represents the name of the statement. Scope String var is scoped to this variable.
2. <c:choose>Syntax:<c:choose> body content (<c:when> and <c:otherwise> child tags) </c:choose> Note: Its body can only be composed of the following elements: 1 space 2) 0 or more <c:when> Sub-label,<c:when> must appear before the <c:otherwise> label. 3) 0 or more <c:otherwise> sub tags.
3. <c:when>Represents a conditional branch of <c:choose> that only uses syntax in <c:choose>: <c:when test= "Testcondition" >//test is a Boolean type, Used to judge the condition of true and false body statement </c:when>
4. <c:otherwise>Represents the final choice in <c:choose>. Must appear at the end <c:otherwise> content </c:otherwise> L
Iteration Label1. <c:forEach> Syntax 1: iterating <c:foreach[var= "VarName" in Collection Items= "collection" [varstatus= "Varstatusname"] [ begin= "Begin" [end= "End"] [step= ' Step '] body content </c:foeEach> Syntax 2: Number of iterations fixed. <c:foreach [var= "VarName"] [varstatus= "Varstatusname"] [begin= "Begin"] [end= "End"] [step= ' Step '] body content </c: The foeeach> name type describes the parameters of the Var String iteration, which is a label parameter that references the contents of the tag in other tags. Items Collection, ArrayList, collection of items to iterate over. Iterator, Map, String, eunmeration, and so varstatus string represent the state of the iteration, and the information of the iteration itself can be accessed to indicate where the iteration begins. The end int represents the position of the ending iteration. The step int represents the stride size of the iteration, which defaults to 1. L
URL-related labels1. <c:import>Syntax 1: The contents of a resource use a string object to expose <c:import url= "url" [context= "context"] [var= "VarName"] [scope=] {page|request|session| Application} "] [charencoding=" charencoding "]> content </c:import> Syntax 2: The contents of the resource are exposed externally using the reader object. <c:import url= "url" [context= "context"] varreader= "Varreadername" [charencoding= "charencoding"]> content </c: The import> name type describes the URL string to be imported, which can be a relative path and an absolute path, and can import other host resource context strings when accessing an external context resource using a relative path. The context specifies the name of the resource. The name of the var String parameter. The scope of the scope String var parameter. Cahrencoding String to enter the character encoding for the resource. Varreader String The type of this parameter is reader, which is used to read resources.
2. <c:redirct>Syntax 1: no body condition. <c:redirect url= "Value" [context= "Context"]/> Syntax 2: In the body case, specify the parameters of the query in the body <c:redirect url= "value" [context=] Context "]> <c:param name=" name value= "value"/> </c:redirect>
3. <c:url>Syntax 1: No body <c:url value= "value" [context= "context"] [var= "VarName"] [scope= "{page|request|session+application}"] /> Syntax 2: Has the body <c:url value= "value" [context= "context"] [var= "VarName"] [scope=] {page|request|session+ Application} "]> <c:param name=" name value= "value"/> </c:url> name type description value string URL values context string when using When a relative path accesses an external context resource, the context specifies the resource's name Var String to identify this URL scalar. Scope String variable scoped. L
SQL-related labels1. <sql:setDataSource> 2. <sql:query> 3. <sql:update> 4. <transaction> 5. <param>
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.