因为我新增页面和编辑页面是同一个,我新增的时候是没问题的,但是到了编辑的时候,我的二级字典显示出来的是ID而不是name(easyui combotree 实现的二级字典)
入下列jsp
<tr>
<td class="left" width="10%">
区域:
</td>
<td class="right">
<form:select id="classify" path="classify">
<c:if test="${not empty user.codeDict}">
<form:option  title="${user.codeDict.displayValue}"value="${user.codeDict.id}">${user.codeDict.displayValue}</form:option>
</c:if>
<form:options items="${countryList}" itemValue="id" itemLabel="displayValue" id="classifyId"/>
</form:select>
</td>
</tr>
查看源文件如下:
<tr>
<td class="left" width="10%">
区域:
</td>
<td class="right">
<select id="classify" name="classify">
 
<option title="海淀区" value="4028877731ffccc60131ffcef4770001" selected="selected">海淀区</option>
<option id="classifyId1" value="4028877731f987870131f99be8c60002">中国</option>
</select>
</td>
</tr>
这源文件是正确的,但是显示的时候就是显示value的id值

解决方案 »

  1.   

    页面上显示的值不是name  而是ID的值
    也就是说 ${user.codeDict.displayValue}查看源文件的时候是有的 但页面上显示是${user.codeDict.id}的值
      

  2.   

    修改的时候要把原来的值赋给<option> ,为什么要用itemValue,就是为啥家item呢,直接用循环就行了
      

  3.   


    其实<form:options items="${countryList}" itemValue="id" itemLabel="displayValue" id="classifyId"/>
    这句是可以删除的,这里用了easyui combotree 不需要遍历 因为出来的是json对象