我有这个struts2 select标签,其中的选项是Item对象的列表.假设Item java bean类具有以下3个属性:itemId, itemLabel, itemDescription.
我的选择标签看起来像这样:
<s:select headerKey=""
headerValue="Select Item"
list="myModel.itemsList"
listKey="itemId"
listValue="itemLabel"
name="selectedItem" />
Run Code Online (Sandbox Code Playgroud)
我希望每当用户使用该选项时,在下拉菜单中显示每个选项的工具提示.填充该工具提示的文本存储在itemDescription我的java bean类的属性中
我知道你可以为select标签提供一个tooptip,但这不是我需要的,因为每个选项/项目都有不同的描述.
目前我有一个自定义的javascript工具提示,如果可能的话我想使用这个功能.如果项目将列在表格中,我将使用该函数:
<td>
<span class="tooltip" onmouseout="tooltip.hide();"
onmouseover="tooltip.show('<s:property value="item.description" />');">
<s:property value="item.label" />
</span>
</td>
Run Code Online (Sandbox Code Playgroud)
有没有人知道什么是最好的解决方案,description每当用户将鼠标悬停在选项上时显示为工具提示?