读书人

Struts关于lt;html:selectgt;的排序解决方

发布时间: 2012-01-23 21:57:28 作者: rapoo

Struts关于<html:select>的排序
问题:我从数据库检索数据出来,要显示到jsp的select下拉菜单中
但问题是-----〉我在数据库中筛选出来的数据是按照id已经排好序放在hashmap中的,但从select显示出来的,确是随机的,并没排好
有经验的进来看看

Java code
<html:select property="gpname"   onclick="document.getElementById('gname').value=this.options[this.selectedIndex].value;" size="5"  style="width=100%;height=300">  <html:options collection="gpList" property="key" labelProperty="value"/></html:select>


[解决办法]
把VALUE的值放到(有序的集合)TREESET里.

读书人网 >Java Web开发

热点推荐