I want to display the key value bean based on sorting of value in Struts 2

邮差的信 提交于 2019-12-02 08:13:05

You can try and sort the values in Action class itself, so when select is rendered the list will appear sorted

Roman C

The List is an ordered collection. If it contains elements sorted by the key property then other the value property remains unsorted unless it's the same property. To make it sorted on another property you can sort the list with the comparator.

Collections.sort(myList, myComparator);

or you can use s:sort tag like in this example. And you only have to provide the comparator in the action class.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!