单选按钮和 下拉框 的 thymeleaf的回显


https://blog.youkuaiyun.com/qq_34262794/article/details/80380566

大佬给力


 

  <div class="layui-inline">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-inline">
                <input type="radio" name="sex" value="男" title="男" th:if="${staff.sex ne null}" th:field="${staff.sex}">
                <input type="radio" name="sex" value="女" title="女" th:if="${staff.sex ne null}" th:field="${staff.sex}">
                <input type="radio" name="sex" value="男" title="男" th:if="${staff.sex eq null}" th:checked="checked">
                <input type="radio" name="sex" value="女" title="女" th:if="${staff.sex eq null}">
            </div>
        </div>

thymeleaf 的方式回显 单选按钮


 <div class="layui-input-inline">
                    <input th:each="item:${statuslist}" type="radio" name="repairstatus" th:value="${item.commondesc}" lay-filter="repairstatus" th:text="${item.commonname}"  th:field="*{obj.repairstatus}"/>
                </div>







    model.addAttribute("obj",MaintenanceinfoService.getinfo(entity));
        model.addAttribute("statuslist",commonService.tools("123"));

 


<select name="fireboxroltype">
    <option value="">请选择</option>
    <option th:selected="${abc.ficontroltype eq item.name}" th:each="item:${model}"
            th:text="${item.name}"
            th:value="${item.code}"></option>
</select>

 

走两个model。 ficontroltype 是查出来的code值。需要 eq 对应上code值。然后好像thymeleaf进行渲染,接着显示对应的name值。----上面的都是动态回显。

 


来个静态的额。

 <select name="comrepairdate2end" lay-filter="aihao">
                        <option value="">请选择</option>
                        <option   th:selected="${obj.getComrepairdate2end() eq '上午(8:00-11:00)'}"  value="上午(8:00-11:00)">上午(8:00-11:00)</option>
                        <option   th:selected="${obj.getComrepairdate2end() eq '下午(1:30-5:00)'}"  value="下午(1:30-5:00)">下午(1:30-5:00)</option>

                      <!--  <option   value="上午(8:00-11:00)">上午(8:00-11:00)</option>
                        <option   value="下午(1:30-5:00)">下午(1:30-5:00)</option>-->
                    </select>

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值