<c:choose>
<c:when test="${x.attachPath!=null&&x.attachPath!=''}">
<a href="http://service.huadongdata.net/boyun/${x.attachPath}" class="u_btn1" target="_blank">查看</a>
</c:when>
<c:otherwise>
<%-- <a class="u_btn1" target="_blank">无附件</a>--%>
<a href ="javascript:return false;" onclick="return false;" style="cursor: default;">无附件</a>
</c:otherwise>
</c:choose>
<c:when test="${x.attachPath!=null&&x.attachPath!=''}">
<a href="http://service.huadongdata.net/boyun/${x.attachPath}" class="u_btn1" target="_blank">查看</a>
</c:when>
<c:otherwise>
<%-- <a class="u_btn1" target="_blank">无附件</a>--%>
<a href ="javascript:return false;" onclick="return false;" style="cursor: default;">无附件</a>
</c:otherwise>
</c:choose>
本文通过一个具体的示例展示了如何使用JSP中的<c:choose>、<c:when>和<c:otherwise>标签来实现条件判断。特别是当需要判断变量是否存在且不为空时,这些标签能有效地帮助开发者控制页面元素的显示与否。
2106

被折叠的 条评论
为什么被折叠?



