Re: DisplayTag - show image by condition
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: > > name="memberDAO.members" decorator="myPackage.MemberListDecorator"> > . > . > . > > > Rich > > > On Dec 5, 2007 12:16 PM, quinquin2209 <[EMAIL PROTECTED]> > 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: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DisplayTag - show image by condition
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 = ""; } else { returnString = ""; } return returnString; } } DOnt forget to include the decorator in your table tag: . . . Rich On Dec 5, 2007 12:16 PM, quinquin2209 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DisplayTag - show image by condition
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]