You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by cellterry <ce...@gmail.com> on 2010/11/06 06:46:01 UTC

Setting css of a row

Dear all,

I want to set a table row with a color retrieved from an action class, could
I do that?

If yes, how to do that?

Terry.

-- 
View this message in context: http://old.nabble.com/Setting-css-of-a-row-tp30146983p30146983.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Setting css of a row

Posted by cellterry <ce...@gmail.com>.
OK, I think a possible way, which is, for example, the following, will show
color or style if a record is cancelled or not.

	<s:iterator value="pos" status="st">
		<s:if test="(pos[#st.index].status&maskCancel)!=0">
			<tr <s:if test="#st.odd">class="data_cancelled0"</s:if>
				<s:else>class="data_cancelled1"</s:else>>
		</s:if>

But if I want to compute css of all records with 3 days before outstanding
day, I will need to add a temporary field in data model for ease of
computation of stylesheet as I want to keep logic not in view side.

Terry.


Dave Newton-6 wrote:
> 
> The same way you retrieve any action property.
> 
> That said, I'm not a fan of mixing layers like that: * possibly* get
> something business- oriented from the action and use CSS to style it...
> but
> a color from the action is poor design.
> 
> Dave
>  On Nov 6, 2010 12:46 AM, "cellterry" <ce...@gmail.com> wrote:
>>
>> Dear all,
>>
>> I want to set a table row with a color retrieved from an action class,
> could
>> I do that?
>>
>> If yes, how to do that?
>>
>> Terry.
>>
>> --
>> View this message in context:
> http://old.nabble.com/Setting-css-of-a-row-tp30146983p30146983.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Re%3A-Setting-css-of-a-row-tp30147066p30152211.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Setting css of a row

Posted by Mead Lai <la...@gmail.com>.
right, set a property in Action.
private String color;
private String css;
then generate get/set.
<table bgcolor='${color}' class='{$css}'>
...
<table/>

Regards,
Mead

Re: Setting css of a row

Posted by Dave Newton <da...@gmail.com>.
The same way you retrieve any action property.

That said, I'm not a fan of mixing layers like that: * possibly* get
something business- oriented from the action and use CSS to style it... but
a color from the action is poor design.

Dave
 On Nov 6, 2010 12:46 AM, "cellterry" <ce...@gmail.com> wrote:
>
> Dear all,
>
> I want to set a table row with a color retrieved from an action class,
could
> I do that?
>
> If yes, how to do that?
>
> Terry.
>
> --
> View this message in context:
http://old.nabble.com/Setting-css-of-a-row-tp30146983p30146983.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Re: Setting css of a row

Posted by Maurizio Cucchiara <ma...@gmail.com>.
As Dave suggested CSS style is the best candidate for this purpose.
The only things that could change my mind, it's if is a model-related
property (f.e. user defined color, preference, etc)

2010/11/6 cellterry <ce...@gmail.com>:
>
> Dear all,
>
> I want to set a table row with a color retrieved from an action class, could
> I do that?
>
> If yes, how to do that?
>
> Terry.
>
> --
> View this message in context: http://old.nabble.com/Setting-css-of-a-row-tp30146983p30146983.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Maurizio Cucchiara

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