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

1545年前 (2020-09-18)SpringBoot5352

下拉框赋值选中:

   <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 = {"零","壹","贰","叁","肆...

plsql 中number类型字段 取消科学计数法显示

 PL/SQL DEVELOPER中禁用科学计数法:Tools - Prefrence - SQL Window - 选择:"Number fields to_char&quo...

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

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

freeMarker 截取字符串(操作字符串函数 )

<#if c.proSummary!?length gt 25>  <!-- 如果长度 >25 截取25个字-->    ...

MyEclipse 10安装svn

MyEclipse 10安装svn

 方法一:在线安装(推荐)1.打开HELP->MyEclipse ConfigurationCenter。切换到SoftWare标签页。 2.点击Add Site 打开对话框...

jquery 操作html元素(及CSS)

jquery 操作html元素(及CSS)

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

发表评论

访客

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