JSTL当中请给出一个c:choose和c:when:标签的例子

3)c:choose,c:when:标签

完成类似java的case的功能:

例 2.2.3


<%@ page contentType="text/html; charset=GBK"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="salary" value="1300" />
<html>
<body>
    <c:choose>
        <c:when test="${salary <=1800}">
                  低薪
    </c:when>
        <c:when test="${salary<=3000&&salary>1800}">
                  中等
    </c:when>
        <c:otherwise>
                 高薪
    </c:otherwise>

详情请见:http://www.mark-to-win.com/index.html?content=Jsp/jspUrl.html&chapter=Jsp/jsp5_web.html#cchoosecwhenExample

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/84874522
今日推荐