JSP JSTL < C: when > tag: condition tag
•
Java
< C: when test = "condition" >... Label body < / C: when >
Example
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <c:set var = "hours"> <%=new java.util.Date().getHours()%> </c:set> <c:choose> <c:when test="${hours>1&&hours<=6}">早上好!</c:when> <c:when test="${hours>6&&hours<=11}">上午好!</c:when> <c:when test="${hours>11&&hours<=17}">下午好!</c:when> <c:when test="${hours>17&&hours<=24}">晚上好!</c:when> </c:choose> 现在时间是:${hours}时
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码