我想根据 Struts 2 中的值排序显示键值 bean

2022-01-16 00:00:00 sorting java jsp comparator struts2

我想根据 Struts 2 中的值排序显示键值 bean.

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

<s:select list="preferredBranchList"  listKey="displayKey"
          listValue="displayValue" name="preferredBranch" 
          cssClass="selectpicker show-tick" required="true"  /> 

它是根据 listKey 对值进行排序.请建议我根据 listValue 对值进行排序.

It's sorting of the values based on listKey. Please, suggest me to sort the values based on listValue.

推荐答案

您可以尝试对 Action 类本身的值进行排序,因此当呈现 select 时,列表将显示为已排序

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

相关文章