Question

So I have a <s:select> tag which is dynamically populated by a returned map of type List<folder> from a connected class. I want to add a header (optgroup) at two points within the select but can't work out how to build upon the already implemented system.

My select is as follows:

<s:select id="%{uid}_folder" theme="simple" list="folderList" 
          listKey="id" listValue="title" value="folderId" />

So as you can see it is populated by using a map to declare the value and key of the select from the key and value of the map.

The map is created through a long process collecting different values from different tables.

I just want to add two optgroup(s) were appropriate. I have gone down to the map generation and can add info at the appropriate place to add say, <optgoup> but the HTML is escaped (which we need)

Please ask if any additional info is required, I am struggling to phrase this question properly.

Was it helpful?

Solution

If you want to add a header to the select tag you can do it with headerKey and headerValue attributes.

<s:select id="%{uid}_folder" theme="simple" list="folderList" listKey="id"
 listValue="title" value="folderId" headerKey="-1" headerValue="Select Folder" />

The select tag doesn't have optgroup generated elements.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top