JSTL的if-else表式

JSTL用法,这里不细讲了,主要是if-else的写法:

代码片段:

<c:choose>
                            <c:when test="${user.role eq 1 }">
                                <a href='<%=request.getContextPath() %>/servlet/setAdminServlet?id=${user.id }'>设为管理员</a>
                            </c:when>
                            <c:otherwise>
                                <a href='<%=request.getContextPath() %>/servlet/setGeneralServlet?id=${user.id }'>取消管理员</a>
                            </c:otherwise>
                        </c:choose>
                        &nbsp;&nbsp;
                        <c:choose>
                            <c:when test="${user.status eq 1 }">
                                <a href='<%=request.getContextPath() %>/servlet/setUserOffServlet?id=${user.id }'>禁用</a>
                            </c:when>
                            <c:otherwise>
                                <a href='<%=request.getContextPath() %>/servlet/setUserOnServlet?id=${user.id }'>解锁</a>
                            </c:otherwise>
                        </c:choose>

 

posted @ 2016-09-09 09:37  sincoolvip  阅读(552)  评论(0编辑  收藏  举报