You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Session A Mwamufiya <sm...@andrew.cmu.edu> on 2007/08/13 23:21:44 UTC

displaying items in different colors in a tag

Hi,

Is there a way, with the current version of struts 2, to use a conditional statement to color code elements that are displayed in a <s:select> tag.  By this, I mean that if I have items in my list that are >4, then they're red, and if they are <= 4, then they are blue.  Obviously, this is not the conditional statement that I would want to use, but it gives an idea of what I'm looking for.  So for the super creative minds out there, here's a small nutcracker ;).

Thanks,
Session


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


Re: displaying items in different colors in a tag

Posted by Session A Mwamufiya <sm...@andrew.cmu.edu>.
Ok, thanks.  I'll look into creating custom templates and see how far I get.

Thanks,
Session


> Session A Mwamufiya wrote:
>> Hi,
>> 
>> Is there a way, with the current version of struts 2, to use a
>> conditional statement to color code elements that are displayed in a
>> <s:select> tag.  By this, I mean that if I have items in my list that
>> are >4, then they're red, and if they are <= 4, then they are blue.
>> Obviously, this is not the conditional statement that I would want to
>> use, but it gives an idea of what I'm looking for.  So for the super
>> creative minds out there, here's a small nutcracker ;).
> 
> A quick look at the documentation for the tag [1] suggests that the short
> answer is 'not out of the box'. There are attributes for controlling the
> CSS class/styles for the containing SELECT element but not, as far as I
> can see, for the individual OPTIONs.
> 
> If nothing else, though, you could write a custom template for this 
> 'special use' and reference it through the template/templateDir
> attributes.
> 
> L.
> 
> [1] http://struts.apache.org/2.x/docs/select.html
> 
> 
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional
> commands, e-mail: user-help@struts.apache.org
> 
> 
> 


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


Re: displaying items in different colors in a tag

Posted by Laurie Harper <la...@holoweb.net>.
Session A Mwamufiya wrote:
> Hi,
> 
> Is there a way, with the current version of struts 2, to use a conditional statement to color code elements that are displayed in a <s:select> tag.  By this, I mean that if I have items in my list that are >4, then they're red, and if they are <= 4, then they are blue.  Obviously, this is not the conditional statement that I would want to use, but it gives an idea of what I'm looking for.  So for the super creative minds out there, here's a small nutcracker ;).

A quick look at the documentation for the tag [1] suggests that the 
short answer is 'not out of the box'. There are attributes for 
controlling the CSS class/styles for the containing SELECT element but 
not, as far as I can see, for the individual OPTIONs.

If nothing else, though, you could write a custom template for this 
'special use' and reference it through the template/templateDir attributes.

L.

[1] http://struts.apache.org/2.x/docs/select.html


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