将 struts2 select 的列表划分为 optgroup

divide the list of struts2 select into optgroup

我有 Struts2 select 标签和名称列表。我想把list分成struts optgroup tag

如下所示
城市

Top Cities  
   >Mumbai  
   >Delhi  
   >Banglore  
Other cities  
   >pune  
   >chandigrah  
   >hyderabad  
>...  
>.. 

我有以下代码,但无法理解如何仅在 optgroup 中显示值,而不是在 select

<s:select name = "cityname" id = "cityname" list = "cityMap" headerKey="-1" headerValue="Select a city"  
                 class="seloptionTxt" > 
                  <s:optgroup label="Top Bank" list = "cityMap" />
                  <s:optgroup label="Other Bank" list = "cityMap" />
-                   </s:select>

征求建议

我通过创建三个不同的列表解决了这个问题

  1. select 标签中的一个空列表
  2. 每个 optarg 标签的两个列表