[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 741
  • Last Modified:

Implementing Tooltip for a Struts select box

Hi - I have several items displayed in a struts select box - for each I would like to implement a tooltip for the user - is there any way to do this ?

Thanks
0
abuyusuf35
Asked:
abuyusuf35
1 Solution
 
JavaGuy78Commented:
If I needed to do this, I would:

1. create a bean that would be used top fill the select list. The bean would have objects for the Label, value and tooltip for each item in the select.
2. Generate the list of options for the select and put them into an ArrayList<SelectListBean>
3. Then in the JSP, I would iterate through the ArrayList, adding a tooltip for each item in the select.

NOTE: the html tag property for what you would call tooltip is "Title" and you can see the usage of the Title property in the code example below.
<select name="parts" size="5" multiple="true">
    <logic:iterate id="sel" type="com.themaskedcrusader.project.beans.admin.SelectListBean" name="selList" scope="request" indexId="count">
        <option value="<bean:write name="sel" property="value"/>" title="<bean:write name="sel" property="toolTip"/>">
            <bean:write name="sel" property="label"/>
        </option>
    </logic:iterate>
</select>

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now