Use 10-Java-JSTL tag libraries

Use JSTL tag library use

      The first step: introducing jar package related to the WEB-INF / lib /, JSTL tag library (standard.jar, jstl.jar)

      Second step: in a JSP file tag library is introduced through taglib directive, for example: <% @ taglib url = "http://java.sun.com/jsp/jstl/core" prefix = "c"%>

      Third step: Examples using tags

         1. <c: if test = "$ {200> 20}"> 200 indeed greater than 20 </ c: if>   

            And if the same program, in fact, the contents of test conditions to meet the conditions of the statement is executed, it is not satisfied is not performed

         2.<c:forEach var = "i" begin = "1" end = "5">${ i }</c:forEach>

            Iterative label to receive the plurality of collection type, var: loop variable name, begin: start element, end: the end of the element, step: iteration step, varStatus: circulation state name

            3. The following is a combination tag, corresponds to switch-case structure in java

           <c:choose>

            Itself only as a parent tag when and otherwise

             <c:when  test = ""></c:when>

                Used to judge whether the conditions established

             <c:when  test = ""></c:when>

 

             <c:otherwise></c:otherwise>

                When the above are false label when the time will perform

          </c:choose>

Guess you like

Origin www.cnblogs.com/qinqin-me/p/12339977.html