Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

[S2] Odd tag behaviour (Newbie)

Roger Varley

2007-02-26


Hi

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

<%@(protected)" %>
<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@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.