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

1545年前 (2020-09-18)SpringBoot4677

下拉框赋值选中:

   <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}"/>隐藏

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

分享给朋友:

相关文章

高情商女孩,女生看了都喜欢

高情商女孩,女生看了都喜欢

 王晨阳:19岁大四,北京航空航天大学,插画专业,夜市卖过化妆品,开过儿童美术教学班,某网站签约网络小说作家,15岁开始,3年时间写了8部小数约24万字;对话1:沈东军 vs王晨阳沈东军:像...

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

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

freemarker 判断日期变量为空处理 及InvalidReferenceException异常处理

at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98);InvalidR...

坑爹的ShowModalDialog 后台传值解决方案

 今天遇到需要ShowModalDialog打开页面,通过acceptanceIds 参数值后台过滤出相应结果前台  var url = "loadAccept...

MyEclipse10.7注册码生成

注意经验里的工具可能不可用,请点击 生成注册码工具  下载。提取码:p1w4MyEclipse10.7注册码激活步骤:点击下面的链接http://jingyan.baidu.com/arti...

org.apache.subversion.javahl.ClientException: The working copy needs to be upgraded svn: Working cop

org.apache.subversion.javahl.ClientException: The working copy needs to be upgraded svn: Working cop

SVN更新出现问题:org.apache.subversion.javahl.ClientException: The working copy needs to be upgraded svn: W...

发表评论

访客

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