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>