gcj wrote:
>
> Hello,
>
> I just started using DisplayTag and am struggling to get my dynamic 
> links/hrefs to work correctly.
>
> I am trying to create a table from a Collection of custom objects.
>
> Each object has a property called “actionCmd” that contains the 
> necessary href for the object.
>
> Unfortunately, the display column with the href includes the same href 
> for every row in the table – the href for the 1^st object in the list. 
> Please see the first display:column item in the example below. What am 
> I doing wrong?
>
> Thanks.
>
> <display:table name="sessionScope.queryResults" id="row"
>
> sort="list" pagesize="10" defaultsort="1" 
> requestURI="/viewqueryresults.do">
>
> <display:column sortable="true" href="${row.actionCmd}" 
> property="primaryKey" title="${isisQuery.colHeader1}" headerClass="isis"/>
>
[snip]
>
>
> </display:table>
>
>
The clue's in the documentation 
(<http://displaytag.sourceforge.net/11/displaytag/tagreference.html#column>)

href: The *base* URL used to construct the dynamic link. If this 
attribute is provided, then the data that is shown for this column is 
wrapped inside a <a href=""> tag with the url provided through this 
attribute. Typically you would use this attribute along with one of the 
struts-like param attributes (param*) to create a dynamic link so that 
each row creates a different URL based on the data that is being viewed. 
An empty href value will generate a link to the current page, preserving 
parameters just like for paging links.

If your actionCmd property is the entire url then you'll be better off with:

<display:column sortable="true" title="${isisQuery.colHeader1}" 
headerClass="isis">
<a href="${row.actionCmd}">${row.primaryKey}</a>
</display:column>

Ed!

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to