action类 private List platformNameList; public List getPlatformNameList() { return platformNameList; } public void setPlatformNameList(List platformNameList) { this.platformNameList = platformNameList; } // supplierNameList平台商列表 this.setPlatformNameList(supplierNameList);
model类 // 平台商code private String supplier_code; // 平台商名称 private String supplier_name; public String getSupplier_code() { return supplier_code; } public void setSupplier_code(String supplier_code) { this.supplier_code = supplier_code; } public String getSupplier_name() { return supplier_name; } public void setSupplier_name(String supplier_name) { this.supplier_name = supplier_name; }
<!-- ftl文件中: 判断subType是否存在,如果就把其转化成字符串与字符串3比较 如果不存在,这位''空字符串和字符串3比较 model.subType?if_exists?string='3' javascript文件中 判断subType是否存在,如果就把其转化成字符串与字符串1比较 如果不存在,这位''空字符串和字符串1比较 '${(model.subType)?if_exists}' == '1' --> <!-- 平台商编码 --> <select name="supplierCode" id="supplierCode"> <option value="">请选择</option> <#foreach vo in platformNameList?if_exists> <#if "${vo.supplier_code}" == "${supplierCode?if_exists}"> <option selected="selected" value="${vo.supplier_code?if_exists}">${vo.supplier_name?if_exists?html}</option> <#else> <option value="${vo.supplier_code?if_exists}">${vo.supplier_name?if_exists?html}</option> </#if> </#foreach> </select>