struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From quinquin2209 <quinquin2209-n...@yahoo.com.hk>
Subject Re: DisplayTag - show image by condition
Date Thu, 06 Dec 2007 11:01:09 GMT

Thanks. This work fine for me.



Richard Sayre wrote:
> 
> You have to make your own decorator:
> 
> I assume your table is populated with a 'Member' list or something
> similar.  In your table decorator create a method that returns the
> image based on the condition:
> 
> 
> public class MemberListDecorator extends TableDecorator {
>    public String getType() {
>         String returnString = new String();
>         Member data= (Member)getCurrentRowObject();
> 
> 
>       if(data.isVip()) {
> 
>         returnString = " \"vip.gif\" ";
>      } else {
>    returnString = "";
>      }
> 
> 
>         return returnString;
>     }
> }
> 
> DOnt forget to include the decorator in your table tag:
> 
> <display:table cellpadding="1" cellspacing="1"
> name="memberDAO.members" decorator="myPackage.MemberListDecorator">
> .
> .
> .
> 
> 
> Rich
> 
> 
> On Dec 5, 2007 12:16 PM, quinquin2209 <quinquin2209-noip@yahoo.com.hk>
> wrote:
>>
>> Hi All,
>>
>> I am trying with the displayTag and I would like to see if it is possible
>> to
>> display an image at the first column depending on some conditions. For
>> example, a "vip.gif" should be shown if the person is a VIP and no image
>> should be shown if the person is normal member. How can I achieve it? Can
>> I
>> do this with TableDecorator?
>>
>> Thanks in advance
>>
>> Queenie
>> --
>> View this message in context:
>> http://www.nabble.com/DisplayTag---show-image-by-condition-tf4950401.html#a14174056
>> 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
>>
>>
> 
> ---------------------------------------------------------------------
> 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://www.nabble.com/DisplayTag---show-image-by-condition-tf4950401.html#a14190249
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


Mime
View raw message