Menu

Passing more than one property to columntag

Help
2005-07-27
2012-10-08
  • Kent Iversen

    Kent Iversen - 2005-07-27

    In one of mine ColumnDecorator classes I need more than one property to handle the decoration of the column.

    As I understand the <display:column property="methodname" .....decorator="some.decorator.class"/> grabs the methodName, uses the Reflection api to actually grab the value from the method and passes it on to the decorator class for the final finish / appearance. Formatting a Date Object is quite easy, as shown in one of the examples submitted with the displaytag distribution and I have made severals myself, including displaying an image.

    My requirements however is this: One column should display some text, along with an image.

    Piece of code from a table before using displaytag:
    ...
    <td>
    <bean:write name="element" property="name" />
    <il:productViewer name="element" property="type" />
    </td>
    ...

    Meaning, within the <td></td> tag I write the name, then by using a taglib and passing in the 'type' property I am returning html code for displaying the proper image. Both name and image is displayed within one 'column' How to solve this with the <display:column> tag?

    I need both the name and image within 1 column (as within <td></td>) not like this:
    <display:column property="name" ..../>
    <display:column property="imageName" ... decorator="some.image.decorator.class/>

    Actually I would like to pass in the object beeing iterated to some attribute in the columntag.

    Anyone with some good ideas?

     
    • Kent Iversen

      Kent Iversen - 2005-07-28

      Consider this as closed. I added a method in the DTO object returning itself.

      SomeDTOObject {
      .
      .
      .
      public SomeDTOObject getSelf() {
      return this;
      }

      }

      <display:table .....>
      <display:column property="self">
      </display:table>

      Allowing me to do more computations inside a ColumnDecorater since I now can retrieve all values from the SomeDTOObject, rather than a simple value from the same object.

       

Log in to post a comment.

MongoDB Logo MongoDB