zoukankan      html  css  js  c++  java
  • thymeleaf单选回显,多选回显,选回显,下拉默认选中第一个

    //默认选中第一个
    <input type ="radio" name="repaymentType"
    th:each ="repaymentType,repaymentState:${repaymentTypeList}"
    th:value="${repaymentType.dictName}"
    th:text ="${repaymentType.dictName}"
    th:attr ="checked=${repaymentState.index==0?true:false}">

    //单选回显
    <input type="radio" name="repaymentType"
    th:each ="repaymentType:${repaymentTypeList}"
    th:value="${repaymentType.dictName}"
    th:text ="${repaymentType.dictName}"
    th:attr ="checked=${financeProductDO.repaymentType == repaymentType.dictName?true:false}">

    //多选回显
    <input type ="checkbox" name="companyRole"
    th:each ="role : ${companyRoleList}"
    th:value="${role.dictName}"
    th:text ="${role.dictName}"
    th:attr ="checked=${companyInformation.companyRole.contains(role.dictName)?true:false}">

    //下拉选回显默认选中 前台接收到参数:user对象和businessList集合
    <option th:selected="${user.businessId eq busi.businessId}"
    th:each="busi:${businessList}"
    th:value="${busi.businessId}"
    th:text="${busi.businessName}" >
    </option>

    当你的才华还撑不起你的野心时
    那你就应该静下心来学习
    当你的能力还驾驭不了你的目标时
    那就应该沉下心来历练
  • 相关阅读:
    Pascal's Triangle
    Pascal's Triangle II
    贪心算法入门
    Jump Game
    Symmetric Tree
    Reverse Words in a String
    [BZOJ2342][Shoi2011]双倍回文
    [HDU3068]最长回文
    [POJ1984]Navigation Nightmare
    [BZOJ3295][Cqoi2011]动态逆序对
  • 原文地址:https://www.cnblogs.com/yang-xiansen/p/10251357.html
Copyright © 2011-2022 走看看