【发布时间】:2020-05-09 05:06:26
【问题描述】:
我正在尝试实现一个 JSTL 逻辑,它根据以下逻辑显示提交按钮:
<c:choose>
<!-- if it's demo mode skip every limit check, if not check them -->
<c:when test="#{dashboard.demoMode == 'false'}">
<c:when test="#{dashboard.allowedTrades == 0}">
<h:commandButton id="buyx" x:data-toggle="modal" x:data-target="#hitsModal" />
</c:when>
<c:when test="#{dashboard.currentBalance == 0}">
<h:commandButton id="buyz" x:data-toggle="modal" x:data-target="#chargeModal" />
</c:when>
</c:when>
<c:otherwise>
<h:commandButton id="buy" action="#{dashboard.calculateProcessing}" />
</c:otherwise>
</c:choose>
但不幸的是,我得到了 2 个按钮 - buyx buyz。这些按钮一起显示。应该只显示一个按钮。
有没有办法实现代码一次只显示一个按钮?
【问题讨论】:
-
内部
c:when标签也应该有自己的容器c:choose标签。 -
@TheBitman:就像在我的回答中一样...您可以投票...原始发布者将接受答案,我们很可能不会再收到他的消息(他一直在线17 分钟前未提供任何反馈)
-
@Kukeltje 这次只是为了你,因为你给了我一个答案:我不回答是因为我在工作。我稍后会在家里测试它。
-
但即使是这种反馈也值得赞赏......总是......所以我们知道(将要)采取行动......谢谢