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

1544年前SpringBoot3367

下拉框赋值选中:

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

相关文章

springboot框架 后台获取微信小程序用户的openid

小程序端app.js中:// 登录     wx.login({       succ...

java实现用ffmpeg 获取视频时长

首先需要引入ffmpeg.exe调用 int time = ConvertM3U8.getVideoTime(downloadPath);方法: st...

linux系统宝塔发布Springboot项目

linux系统宝塔发布Springboot项目

一.首先解析一个域名 指向服务器地址。在宝塔控制面板中,点击 添加站点,这里用的是域名,未绑定域名的同学也可以使用服务器的公网 ip。添加站点后 会自动在 /www/wwwroot/  目录...

酸爽!IDEA 中这么玩 MyBatis,让编码速度飞起!

酸爽!IDEA 中这么玩 MyBatis,让编码速度飞起!

1. 搭建 MyBatis Generator 插件环境a. 添加插件依赖 pom.xmlb. 配置文件 generatorConfig.xmlc. 数据库配置文件 jdbc.propertiesd....

idea中 springboot项目修改页面不编译 无法生效问题解决

idea中 springboot项目修改页面不编译 无法生效问题解决

直接上图:1、找到启动类2.点击下拉,出现下图,点击Edit Configurations3.打开后如图:4.两项全部选中update classes and resources。点击apply应用。...

springboot 实现Java向微信小程序订阅消息推送至“服务通知”

springboot 实现Java向微信小程序订阅消息推送至“服务通知”

最近做的OA系统小程序需要向用户推送待办事项及通知类的提醒消息。微信公众平台开通订阅消息并创建模板。设置消息推送配置.(在开发管理--开发设置。这里的服务器地址使用的第三方微擎)Java端步骤1.获取...

发表评论    

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