jsp - JSTL中的 "if elseif elseif"的等效项

标签 jsp jstl

我尝试使用的JSTL中if()else if()else if()的等效项是什么

<c:choose>
  <c:when></c:when>
  <c:when></c:when><c:otherwise> 
  <c:when></c:when>
  </c:otherwise>
</c:choose>

但它给了错误。

最佳答案

那是因为您混淆了标签。它应该是:

<c:choose>
  <c:when test="..."> ... </c:when>
  <c:when test="..."> ... </c:when>
  <c:otherwise> ... </c:otherwise>
</c:choose>

关于jsp - JSTL中的 "if elseif elseif"的等效项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7160348/

相关文章:

java - 从字节数组设置 img src

java - 如何使用来自另一个 JSP 的参数进行查询

JSP <c :out/> - The default attribute doesn't work?

jsp - 如何在 c 中执行 OR :if statement in jsp

jsf - 在 <ui :repeat>? 中指定元素的条件渲染 <c:if> 似乎不起作用

security - web项目中热定义一个web.xml role-name

javascript - 如何在 Javascript 文本框中显示 JSON 中的转义序列

java - 使用 c 时如何将 cookie 传递给资源 :import?

java - JSTL c :forEach causes @ViewScoped bean to invoke @PostConstruct on every request

java - 使用 jSTL 标签时 <c :if inside javascript i get error