ognl - Create Struts2 select tag with Enumsubset -


i have jsp page , use struts build select tag. jsp code following:

<s:select     required="true"     name="form.tipologia"     label="%{gettext('enum.label')}"     list="@it........enum@values()"     listkey="name()"     listvalue="gettext('enum.' + name())"     headerkey=""     headervalue="%{gettext('enum.')}"  /> 

this code produces me select field enum constants. want create field subset of enum. how can it? possible?

you can use ognl projection this.

<s:select list="@it..enum@values().{? #this != @it..enum@enum_to_exclude}" /> 

this create subset of enum values except 1 want exclude.

if comparing enums doesn't work can compare strings.

<s:select list="@it..enum@values().{? #this.tostring() != 'enum_to_exclude'}" /> 

Comments