jsp - Struts 2 s:optgroup elements are not pre-selected -


problem: when using select (s:select) element supports multiple selection (multiple="true") option groups (s:optgroup), if field has values corresponding elements of option group elements, not default selected.

similar configurations work expected:

  • when lists in s:optgroup instead provided list s:select element, correct options default selected.
  • if same, or different, lists both s:select , s:optgroup, elements in s:select correctly selected, in s:optgroup not.
  • when s:select element instead supports single selection (no multiple="true"), , field (myselections) changed integer instead of list, correct options default selected.

in cases (both problem case , similar cases work expected), selected elements being correctly submitted action, 1 expect given html @ point.

jsp causing problem:

<s:select     name="myselections"     list="#{9:'z'}"     multiple="true"     size="5">     <s:optgroup         label="list a"         list="#{1:'a',2:'b',3:'c'}" />     <s:optgroup         label="list b"         list="#{4:'d',5:'e'}" /> </s:select> 

on off chance related ui theme, tried against both "simple" (the 1 use), , default ("xhtml"), issue presents in both.

there open jira issue looks related, in user's example specify multiple-select field, though user not identify if single-select works.

if known issue, jira issue suggest, there exist known workaround? however, seems have been noted more frequently, if issue struts2, , suspecting error rather framework's causing issue.

differences between actual case , example above: in actual case lists properties on action, instead of static, , s:select list has no elements ({}).

the version of struts 2 2.3.16.2.


my expectation suggested workaround generate select tag , descendants using jsp. if so, there "gotchas" regards using non-struts tag in interface?


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -