[ 
http://jira.codehaus.org/browse/DISPL-550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=227550#action_227550
 ] 

Tom Stroobants commented on DISPL-550:
--------------------------------------

This is not fixed in version 1.2 as mentioned in History.

> uid always returns the same object in column decorators
> -------------------------------------------------------
>
>                 Key: DISPL-550
>                 URL: http://jira.codehaus.org/browse/DISPL-550
>             Project: DisplayTag
>          Issue Type: Bug
>          Components: Decorators
>    Affects Versions: 1.1.1
>            Reporter: Thomas Queste
>            Priority: Blocker
>
> Using the uid property of the table tag ("<display:table uid="row">") does 
> not set the current row object in the page scope. It just put the last table 
> row in pageScope.
> Here is an extract of the org.displaytag.tags.TableTag.doIteration() on line 
> 784 :
> if (this.tableIterator.hasNext())
> {
>   Object iteratedObject = this.tableIterator.next();
>   [...]
>   this.pageContext.setAttribute(getUid(), iteratedObject);
> So when the JSP is rendered, the iterator is called. For each table line, the 
> iteratedObject overwrites the previous row. Then, after all row have been 
> read, the column decorators are called. So If a decorator need the current 
> row object, accessed using the provided pageContext, it will only find the 
> last row object.
> The Javadoc for "uid" is : "The object representing the current row is also 
> added to the pageContext under this name and the current row number is added 
> using the key uid_rowNum." So in a column decorator, using pageContext, we 
> can presume to have access to the current row object. This is not the case : 
> the last table row is the only object in pageScope.
> Example of a column decorator which does not have access to its current row 
> object :
> public class WorkflowStepColumnDecorator implements DisplaytagColumnDecorator 
> {
>   public Object decorate(Object columnValue, PageContext pageContext, 
> MediaTypeEnum media) throws DecoratorException {
>     Object row = pageContext.getAttribute("row");
>     // row is not the current row, it is the last table's row
>   }
> }
> JSP code :
> <display:table uid="row" name="users">
>   <display:column decorator="example.MyColumnDecorator "/>
> </display:table>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
displaytag-devel mailing list
displaytag-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to