In 1.0 you can do that without using decorators, inserting the link
directly in the body of the column tag.

A sample with a column decorator:
<display:table name="test">
        <display:column property="id" decorator="somedecorator"
title="actions" />
</display:table>

... and without:
<display:table name="test" id="item">
        <display:column title="actions">
                <a
href="action/links?id=<%=((Item)item).getId()%>">edit</a>
        <display:column>
</display:table>

of course you can use jstl or any other custom tag in the column body,
instead of the scriptlet.

fabrizio

-----Original Message-----
From: Matt Raible [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 23, 2003 9:20 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [displaytag-devel] RE: Display taglib

Matthew - I'm forwarding your question to the developers list in hopes
of getting a more knowledgeable answer (I haven't worked with or helped
develop the latest release).

Matt

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 23, 2003 12:30 PM
To: [EMAIL PROTECTED]
Subject: CP: Display taglib


I posted this comment to your blog, but the formatting is kind of
message up --->

I was looking through the release of displaytag-1.0-b1. 

I'm curious if there is a simplier way of creating an "Actions" column
without creating a Decorator that hard codes the links.

Re: 
public String getLink2() 
        { 
                ListObject lObject= (ListObject)getObject(); 
                int lId= lObject.getId(); 

                return "<a href=\"details.jsp?id=" + lId 
                        + "&action=view\">View</a> | " 
                        + "<a href=\"details.jsp?id=" + lId 
                        + "&action=edit\">Edit</a> | " 
                        + "<a href=\"details.jsp?id=" + lId 
                        + "&action=delete\">Delete</a>"; 
        } 

Could you achieve more flexiblity with creating an "Actions" column type
that takes an href list like this code?   
Or something else that allows you to put some type of expression in? 

name="hreflist" value="edit,edit.jsp;delete,delete.jsp"  
Example from -->
http://www.sutternow.com/CodeStuff/jsp/grids/gridtest.jsp 

   1:<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %> 
   2:<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml"; %> 
   3:<%@ page import="com.sutternow.xmlSelect"%> 
   4:<% 
   5:       xmlSelect objXML = new xmlSelect(); 
   6:       objXML.setJndiname("java:comp/env/jdbc/sutterdb"); 
   7:       objXML.setQuery("select * from Customers"); 
   8:%> 
   9:<c:import url="/includes/xslt/sortablegrid.xslt" var='xslt'/> 
  10:<x:transform  xslt="${xslt}"> 
  11:<x:param name="hreflist" value="edit,edit.jsp;delete,delete.jsp"/> 
  12:<%=objXML.getXml().toString().trim()%> 
  13:</x:transform> 

I know this code is a different animal, but I think it's a pretty severe
anti-pattern to have your links hard-coded in a decorator class.
Thoughts???

Matthew Payne 




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to