Menu

How to create an "Actions" column

Help
Luke
2005-04-13
2012-10-09
  • Luke

    Luke - 2005-04-13

    Hi there.

    I would like to add to my table a column with the classic Actions (view, edit, delete).

    To do that I'm following the sample in the documentation.

    I added the attribute:
    decorator="org.displaytag.sample.Wrapper"
    and the column:
    <display:column property="link2" title="Actions" />

    and then I've added the class org.displaytag.sample.Wrapper to my classpath.

    This class has a method getLink2():
    public String getLink()
    {
    ListObject lObject= (ListObject)getCurrentRowObject();
    int lId= lObject.getId();

        return &quot;&amp;lt;a href=\&quot;details.jsp?id=&quot; + lId
    
            + &quot;&amp;amp;action=view\&quot;&gt;View&amp;lt;/a&gt; | &quot;
            + &quot;&amp;lt;a href=\&quot;details.jsp?id=&quot; + lId
            + &quot;&amp;amp;action=edit\&quot;&gt;Edit&amp;lt;/a&gt; | &quot;
            + &quot;&amp;lt;a href=\&quot;details.jsp?id=&quot; + lId
            + &quot;&amp;amp;action=delete\&quot;&gt;Delete&amp;lt;/a&gt;&quot;;
    }
    

    I get the data from a database (and not from the ListObject class as in the sample) and therefore I have a problem when I try to do the cast:
    (ListObject)getCurrentRowObject();

    But I cannot how to cast this object ( getCurrentRowObject())
    and to get the ID value of the row.

    Can anybody helps me?

    Thanks

    LuKe

     
    • Sushma Singh

      Sushma Singh - 2008-01-04

      Replace ListObject with your bean class.

       

Log in to post a comment.