sortingstruts2comparator

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


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"  /> 

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


Solution

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