【发布时间】:2011-08-04 23:14:28
【问题描述】:
我有这个 struts2 选择标签,其中选项是 Item 对象的列表。
假设 Item java bean 类具有以下 3 个属性:itemId, itemLabel, itemDescription。
我的选择标签看起来像这样:
<s:select headerKey=""
headerValue="Select Item"
list="myModel.itemsList"
listKey="itemId"
listValue="itemLabel"
name="selectedItem" />
每当用户悬停在该选项上时,我想在下拉菜单中为每个选项显示一个工具提示。填充该工具提示的文本存储在我的 java bean 类的 itemDescription 属性中
我知道你可以给选择标签一个顶部提示,但这不是我需要的,因为每个选项/项目都有不同的描述。
目前我有一个自定义的 javascript 工具提示,如果可能的话,我想使用这个功能。如果项目将列在表格中,这就是我将如何使用该函数:
<td>
<span class="tooltip" onmouseout="tooltip.hide();"
onmouseover="tooltip.show('<s:property value="item.description" />');">
<s:property value="item.label" />
</span>
</td>
有谁知道每次用户将鼠标悬停在某个选项上时,将description 显示为工具提示的最佳解决方案是什么?
【问题讨论】: