zoukankan      html  css  js  c++  java
  • 获取B表数据添加到A表中作为一个下拉列表元素存在

    1.ProductController类里toedit方法内添加:

    ProductModel product = ProductModel.dao.findById(id);
    //通过id查找服务类

    String sqlstr = "select * from product_type where isDel=0 and fcode is null";
    //获取服务类别表内所有未删除(并且父类型为空的)数据存放在字符串中

    List<ProductTypeModel> productTypeList = ProductTypeModel.dao.find(sqlstr);
    //创建列表存放字符串中保存的服务类别内容

    setAttr("productTypeList", productTypeList);
    //为服务类别列表赋值

    2.ProductPage文件夹下formPage.html中修改

    <div class="form-group">
      <label class="col-sm-3 control-label no-padding-right" for="homepage"> 请选择服务类型 </label>
      <div class="col-sm-9">
        <select name="producttype" class="col-xs-10 col-sm-5" id="producttype">
          <%for(producttype in productTypeList!){%>
            <option value="${producttype.code}" <%if(product.producttype!'' == producttype.code){%> selected="selected"<%}%>>${producttype.name}</option>
          <%}elsefor{%>
            <option value="producttype">请选择服务类型</option>
          <%}%>
        </select>
      </div>
    </div>

  • 相关阅读:
    【leetcode】Recover Binary Search Tree
    【leetcode】Dungeon Game
    【leetcode】Text Justification
    【leetcode】Largest Number
    【leetcode】Merge k Sorted Lists
    【leetcode】Reverse Nodes in k-Group
    【leetcode】Multiply Strings
    【leetcode】Unique Binary Search Trees II
    hdu 1885 bfs+状压
    hdu 1429 bfs+状态压缩
  • 原文地址:https://www.cnblogs.com/FloraIgnace/p/6084972.html
Copyright © 2011-2022 走看看