尝试以百里香形式填充复选框时无法解析为表达式

时间:2019-05-14 15:31:04

标签: html spring-boot checkbox thymeleaf

我正在尝试从Spring Boot返回的模型对象中以thymeleaf html格式填充值,下面是代码。实例是主要对象,它包含一个数组,通道,其中包含[web,corp,mobile]

之类的值
<div th:object = "${instance}">

<div class="control-group">
        <label class="control-label"  >Applicable on</label>
        <div class="controls">
            <label class="checkbox inline">
            <input class="input-style" type="checkbox" value="web" id="channel1" name="channel" th:checked="${(instance.channel.contains("web")
            )}">
            web
            </label>
            <label class="checkbox inline">
                <input class="input-style" type="checkbox" value="corp" id="channel2" name="channel" th:checked="${(instance.channel.contains("corp")
                )}">
                corp
            </label>
            <label class="checkbox inline">
                <input class="input-style" type="checkbox" value="mobile" id="channel3" name="channel" th:checked="${(instance.channel.contains("mobile")
                )}">
                mobile
            </label>
        </div>
    </div>

运行该应用程序时,出现以下错误

Cannot render error page for request [/5cdaabf9d7d4ae55db7ad1ae] and exception [Could not parse as expression: "${(instance.channel.contains(" (template: "editFilter" - line 199, col 94)] as the response has already been committed. As a result, the response may have the wrong status code

有人可以帮助我解决如何从数组中修复和填充表单中的复选框吗?

0 个答案:

没有答案