Hi all! I have got the following Bean:
public class AddressBean { private String name = ""; private String mail = ""; public AddressBean( String name, String mail) { this.name = name; this.mail = mail; // getters and setters here... } I have got List of several AddressBeans, for example List resultList = new Vector(); resultList.add(new AddressBean( "Peter", "[EMAIL PROTECTED]" )); resultList.add(new AddressBean( "Hans", "[EMAIL PROTECTED]" )); which I put into request scope. On a jsp page i would like to display a table for this list which only shows the name, but it should be a mail-link if the mail for this name is not null: f.e. <a href="mailto:[EMAIL PROTECTED]">Peter</a> So i tried the following: <display:table name="resultList" id="myTable"> <display:column property="name" decorator="MailDecorator"> </display:table> If I am right myTable contains the current row. So my MailDecorator looks like this: public class MailDecorator implements DisplaytagColumnDecorator { public Object decorate( Object columnValue, PageContext pageContext, MediaTypeEnum media ) throws DecoratorException { AddressBean addr = (AddressBean) pageContext.getAttribute( "myTable" ); System.out.println(addr.getName()); if( addr.getMail() == null ) { return columnValue; } return "<a href=\"mailto:" + addr.getMail() + "\">" + columnValue + "</a>"; } } I thought this will work, but I get the following result: <table id="myTable"> <thead> <tr> <th>Name</th> </tr></thead> <tbody> <tr class="odd"> <td><a href="mailto:[EMAIL PROTECTED]">Peter</a></td> </tr> <tr class="even"> <td><a href="mailto:[EMAIL PROTECTED]">Hans</a></td> </tr> </tbody> </table> As you can see the mail for Peter is [EMAIL PROTECTED], too, and it is for all other entries in the list... It seems that myTable always contains the last entry in the list, because the log always prints out: Hans. Is this an error or am I doing something wrong? Thanks Peter ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user