You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Peter Cheung <pe...@borderfree.com> on 2000/06/28 15:15:41 UTC

Style Sheet Tag

    I remember that Craig mentioned last week about the tag for supporting
Custom Style Sheet. I think it is the "style" tag, but I could not find it
from the tag documentation. I wonder if it is implemented. If so, then what
is the tag ? Thx in advance.

Peter Cheung
http://www.borderfree.com



Re: Style Sheet Tag

Posted by Craig McClanahan <Cr...@eng.sun.com>.
Peter Cheung wrote:

>     I remember that Craig mentioned last week about the tag for supporting
> Custom Style Sheet. I think it is the "style" tag, but I could not find it
> from the tag documentation. I wonder if it is implemented. If so, then what
> is the tag ? Thx in advance.
>
> Peter Cheung
> http://www.borderfree.com

Most of the Struts custom tags that render HTML now support two optional
attributes related to stylesheets:

The "style" attribute lets you include CSS stuff directly in the tag.  For
example:

    <struts:text property="username" style="color: blue"/>

To refer to a class you've defined in your stylesheet, use the "styleClass"
attribute instead:

    <struts:text property="username" styleClass="pastoral"/>

Why did we call we call it styleClass instead of class?  Well, the getClass()
method already exists on all Java objects -- it returns the java.lang.Class
defining the object type -- so we couldn't write the JavaBeans property
getters and setters in the usual way.  Using "styleClass" seemed like the
least offensive alternative.

Craig