recently in the development of often use JSTL label, feel good to use, here are a few more commonly used Jstl label, for everyone to reference, but also the review of their own knowledge and review it!
The first one is the if in the Process Control label, which is used very much. Specific wording:
<c:if test= "Conditions" > Execute statements </c:if>
For example, Condition 1 is established, a button is displayed, Condition 2 is set up to display a hyperlink:
if you want to make logical judgments, use and and OR, this and Java && and | | Different, at first I thought it was Java, and then I knew it wasn't.
If there are many conditions, can it be judged like if ElseIf else in Java? The answer is, of course, OK:
Use the <c:choose></c:choose> inside the set <c:when test= "" ></c:when> make multiple statements of judgment can
<c:choose> <c:when test= "${score>=90}" > your score is excellent! </c:when> <c:when test= "${score>=70 and Score<90}" > your score is good! </c:when> <c:when test= "${score>60 and Score<70}" > your grades are passed </c:when> <c:otherwise> Sorry, you didn't pass the exam! </c:otherwise></c:choose>
Process Control label is finished, in said Loop label, here to say aForEach
Over hereAllproducts is a collection of products that contains a lot of product, loops through each element in it, and puts it in a checkbox to achieve a multi-marquee effect.
<c:foreach var= "Product" items= "${allproducts}" > <label class= "checkbox inline" > <input Type = "checkbox" Name= "ProductId" value= "${product.id}" >${product.name} </label></c:forEach>
<c:forEach> tags can also be addedvarstatus= "idx" and then inside we can make judgments like${idx.index>0} or${idx.index++}
To get the length of a list collection, you can use the FN function
to import Tags: <%@ taglib prefix= "FN" uri= "http://java.sun.com/jsp/jstl/functions"%>
JSTL Common Tag Library Introduction