如何使用 JSTL 使复选框 属性 为真

how to make checkbox property true using 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>

您不需要 <c:choose>。只需将复选框的条件设置为 value,如下所示:

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