You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Roger Varley <ro...@googlemail.com> on 2007/02/26 18:27:53 UTC

[S2] Odd tag behaviour (Newbie)

Hi

I'm using Struts 2.0.06 and I have a simple jsp page

<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<body>
        <s:iterator value="servers">
            <s:label value="HostName" cssClass="serverlabel"/>
            <s:property value="hostName"/><br>
            <s:label key="server.bootTime" cssClass="serverlabel"/>
            <s:property value="bootTime"/><br>
        </s:iterator>
    </body>
</html>

which is rendering as


<html>
<body>
<tr>
<td class="tdLabel"></td>
<td><label id="" class="serverlabel">HostName</label></td>
</tr>
 frozen.brake.co.uk
<tr>
<td class="tdLabel"><label for="server_bootTime" class="label">Start
Time:</label></td>
<td><label id="server_bootTime" class="serverlabel"></label></td>
</tr>
2/26/07
<tr>
<td class="tdLabel"></td>
<td><label id="" class="serverlabel">HostName</label></td>
</tr>
grocery.brake.co.uk<br>
<tr>
<td class="tdLabel"><label for="server_bootTime" class="label">Start
Time:</label></td>
<td><label id="server_bootTime" class="serverlabel"></label></td>
</tr>
2/26/07
</body>
</html>

It appears that when I use the "value" attribute on the s:label tag,
my defined ccClass attribute gets attached to the text value of the
tag (class="serverlabel"). However, when I use the key attribute to
refer to a .properties file, it appears that the tag is generating
it's own class reference for the text (class="label") and adds my
class definition in a seperate table column.

I'd guess that I'm not understanding something about the tag library
behaviour, but I don't know enough to know where to start,

Regards
Roger

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org