write a bean to the title attribute of an element in a jsp page
I have a jsp page that is calling a action form my problem is how do I get the data in eac开发者_JAVA技巧h row to not only get written to be the bean but also put it in the title attribute?
<td>
<bean:write name="data" property="aName" />
</td>
<td>
<bean:write name="data" property="aSport" />
</td>
<td>
<html:checkbox indexed="true" name="sportForm" property="assignSport"
title="<%=sporttForm.getaName %><%=sporttForm.getaSport %>" />
</td>
I would like the title when the checkbox is hovered over to be something like: John Smith - Football
Try using the alt
attribute, rather than title
. So,
<html:checkbox indexed="true" name="sportForm" property="assignSport" alt="<%=sporttForm.getaName %><%=sporttForm.getaSport %>" />
The jsp:attribute element allows you to define the value of a tag attribute in the body of an XML element instead of in the value of an XML attribute.
JSP Syntax
XML Syntax Same as JSP syntax.
Examples The following template page uses jsp:attribute, which uses the output of fmt:message to set the value of the value attribute of tt:parameter:
...
<tt:screen id="/bookcatalog">
<tt:parameter name="title" direct="true">
<jsp:attribute name="value" >
<fmt:message key="TitleBookCatalog"/>
</jsp:attribute>
</tt:parameter>
...
</tt:screen>
...
Source: http://java.sun.com/products/jsp/syntax/2.0/syntaxref2014.html
精彩评论