在Struts 2中使用自定义数据属性:选择

wh0*_*wh0 2 struts2 struts-tags

我试图在Struts2标签中使用HTML的自定义数据属性,这是我的示例代码

<s:select list="myList" listKey="myListVal"  listValue="myListDesc"  data-inputs="myListInput" ></s:select>
Run Code Online (Sandbox Code Playgroud)

我期待这样的事情

<select >
     <option value="myListVal1" data-inputs="myListInput1">myListDesc1</option>
     <option value="myListVal2" data-inputs="myListInput2">myListDesc2</option>
     <option value="myListVal3" data-inputs="myListInput3">myListDesc3</option>
</select>
Run Code Online (Sandbox Code Playgroud)

相反,我得到了这个

<select data-inputs="myListInput" >
     <option value="myListVal1" >myListDesc1</option>
     <option value="myListVal2" >myListDesc2</option>
     <option value="myListVal3" >myListDesc3</option>
</select>
Run Code Online (Sandbox Code Playgroud)

是否可以在其中的选项的struts select标签中描述data-attribute.

Ale*_*r M 5

覆盖<s:select>标记模板.或者只使用HTML标签<s:iterator>

<select name="list">
   <s:iterator value="myList" status="stat">
      <option value="<s:property value="myListVal"/>" data-inputs="myListInput<s:property value="#stat.index"/>"><s:property value="myListDesc"/></option>
   </s:iterator>
</select>
Run Code Online (Sandbox Code Playgroud)