如何使用JSTL使checkbox属性为true

时间:2018-04-20 07:00:54

标签: liferay jstl

如果<c:when>条件为真,如何选中复选框?

<c:set var="status" value="${expData.status}" />
<c:choose>
    <c:when test="${status == 'Business Unit Approal'}">
        <aui:input cssClass="custom-control-input expense select-all" type="checkbox"
            data-amount="${expData.expenseAmount}" data-expenseid="${expData.expenseId}"
            id="expenseCheckbox" name="expenseCheckbox" label="" checked="checked" />
    </c:when>
    <c:otherwise>
        <aui:input cssClass="custom-control-input expense select-all" type="checkbox"
            data-amount="${expData.expenseAmount}"data-expenseid="${expData.expenseId}"
            id="expenseCheckbox" name="expenseCheckbox" label="" />
    </c:otherwise>
</c:choose>

我认为我的情况不适用于<c:when>

1 个答案:

答案 0 :(得分:2)

你不需要Label label = ... label.textFillProperty().bind(Bindings.createObjectBinding(() -> label.getText().startsWith("-") ? Color.RED : Color.BLACK, label.textProperty())); 。只需将复选框的条件设置为<c:choose>,如下所示:

value