“title” attribute for <html:options> struts tag

风格不统一 提交于 2019-12-12 01:17:56

问题


In a regular select box you can show the full title on mouseover using "title" attribute in the "option" field.

In Apache Struts, you make the select box with the "html:options" tag. I don't think this tag supports the "title" attribute. Is there another way to show the full title of an option on mouseover for the "html:options" struts tag?

Thanks


回答1:


Struts' tag for <select><option>.. is <s:select />, or <s:doubleselect /> for double lists. <s:doubleselect /> doesn't support title at all, you have to modify the Javascript it generates by hand (ddoubleselect.ftl). For with the default theme, the file is found in struts2-core-2.1.6.jar under template/simple/.




回答2:


hard code in html or jsp file is a bad code practice.

if you are writing code in struts 1.x try to store all messages in MessageResources_en.properties

try update your jsp with following (alternatively go for )

title="<bean:message key="your_tool_tip"/>

and modify MessageResources_en.properties

your_tool_tip=toolTIp is a cool idea

ps there are solutions available in jquery as well




回答3:


I'll admit to not being familiar with Apache Struts. If nobody more familiar can find you a better solution then worst case you could do it as a javascript tooltip. It's more effort, but gives you more effective visual control over the presentation.



来源:https://stackoverflow.com/questions/1040088/title-attribute-for-htmloptions-struts-tag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!