thymeleaf 判断select 下拉框 赋值并选中

1545年前 (2020-09-18)SpringBoot5170

下拉框赋值选中:

   <div class="form-group">
                <label class="col-sm-3 control-label">类别:</label>
                <div class="col-sm-8">
                    <select name="category" class="form-control" type="text" id="category" th:field="*{category}">
                        <option th:value="0" >本省</option>
                        <option th:value="1" >省外资源</option>
                    </select>
                </div>
            </div>
            
<div class="col-sm-8">
    <select name="teachpoint" class="form-control m-b" th:with="type=${@dict.getType('teach_point')}">
        <option></option>
        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"  ></option>
    </select>
</div>

单选框选中:

  1. <-- aa为值 -->

  2. <input type="radio"  name="aa"  th:value="0" th:checked="${aa==0}"/>显示

  3. <input type="radio"  name="aa"  th:value="1" th:checked="${aa==1 }"/>隐藏

  4. <-- aa为对象属性 -->

  5. <input type="radio"  name="aa"  th:value="0" th:field="*{aa}"/>显示

  6. <input type="radio"  name="aa"  th:value="1" th:field="*{aa}"/>隐藏

本文原创,转载必追究版权。

分享给朋友:

相关文章

java将金额转化为大写金额

 private static String[] num = {"零","壹","贰","叁","肆...

揭秘!如何用一句话找到你的一万微友

 玩微商一年半的时间了,现在的微商如火如荼,很多刚进入微商行业的伙伴都在烦恼一个问题,那就是粉丝、粉丝,我最近调查了身边30多个微友,有25个竟然都是好友问题,有的竟然给我说主动加了50多个...

使用Myeclipse 8.5开发基于JAX-WS的Web service实例

 本文为Web service 开发入门篇,主要介绍在Myeclipse 8.5环境下开发Web service的服务程序和客户端程序的基本流程。 在Weblogic 11g...

get方式调用http接口   Header赋参数值

get方式调用http接口 Header赋参数值

   /**      195.     * 发送...

jquery 操作html元素(及CSS)

jquery 操作html元素(及CSS)

 $("li").addClass("aui-user-view-cell aui-img") ;  //给元素添加样式$('#a1...

竟然可以这样打扮!女人呆了!男人痴了!

来个轻松点的哇,惊呆了,肯定贵不了,立刻去瞅瞅...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。