如何在 JSTL 中使用 if-else 选项 [英] How to use if-else option in JSTL

查看:35
本文介绍了如何在 JSTL 中使用 if-else 选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JSTL 中是否有可用的 if-else 标签?

Is there an if-else tag available in JSTL?

推荐答案

是的,但它很笨拙,例如

Yes, but it's clunky as hell, e.g.

<c:choose>
  <c:when test="${condition1}">
    ...
  </c:when>
  <c:when test="${condition2}">
    ...
  </c:when>
  <c:otherwise>
    ...
  </c:otherwise>
</c:choose>

这篇关于如何在 JSTL 中使用 if-else 选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆