The following comment has been added to this issue:

     Author: fabrizio giustina
    Created: Thu, 4 Nov 2004 6:42 PM
       Body:
another try:
- you have now a "uid" attribute instead of "id" (just a little more generic than 
tableId for future developments).
- I also added the className bean property requested by dynamo, please let me know the 
final results for both patches

---------------------------------------------------------------------
View this comment:
  http://jira.codehaus.org/browse/DISPL-56?page=comments#action_26085

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/DISPL-56

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: DISPL-56
    Summary: unable to dinamically generate multiple tables on the same page with 
indipendent sorting (different id)
       Type: Bug

     Status: Resolved
   Priority: Major
 Resolution: FIXED

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: DisplayTag
 Components: 
             Container Compability
   Fix Fors:
             1.0 RC2
   Versions:
             1.0 RC1

   Assignee: fabrizio giustina
   Reporter: Keith Garry Boyce

    Created: Sun, 10 Oct 2004 7:48 AM
    Updated: Thu, 4 Nov 2004 6:42 PM

Description:
If I pass id in as <%= string %> value I get classcast exception
The code below with varying name also doesn't work. I sent this also to you guys 
because my mail in the past hasn't got onto forum.

Thanks,
Garry
Here is an example of the problem (below is a workaround but you probably have better 
one):

<%@ taglib uri="http://displaytag.sf.net"; prefix="display" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<html>
<body>
test
<%!
  public class ValueBean {
        public ValueBean(String value) {
                this.value=value;
        }
        private String value;
        public String getValue() {
                return this.value;
        }
  }
%>
<%
  List theList = new ArrayList();
  theList.add(new ValueBean("1"));
  theList.add(new ValueBean("2"));
  theList.add(new ValueBean("3"));

  for (int i=0;i<3;i++) {

        request.setAttribute("row" + String.valueOf(i),new ArrayList(theList));
%>

                <display:table class="disp"

                               id="row"
                               name="<%= "row" + String.valueOf(i) %>"
                               sort="list" >
                      <display:column property="value" sortable="true"/>
            </display:table>
<% } %>
</body>
</html>


Workaround:
have anonther attribute called tableId. I'm using reflection code for visibility 
issues.
/*
 * TableTag2.java
 * 
 * Copyright 2004 by Electronic Data Systems
 * Corporation. All rights reserved.
 *
 * An unpublished work created Aug 5, 2004, 2004. This work is a
 * trade secret of EDS and unauthorized use or copying
 * is prohibited.
 * 
 */
package org.displaytag.tags;

import java.lang.reflect.Field;

import org.displaytag.util.ParamEncoder;

/**
 * @author jztb88
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class TableTag2 extends TableTag {
        
        private String tableId;
        
        /**
         * @return Returns the tableId.
         */
        public String getTableId() {
                return tableId;
        }
        
        /**
         * @param tableId The tableId to set.
         */
        public void setTableId(String tableId) {

                try {
                        Field fld = TableTag.class.getDeclaredField("paramEncoder");
                        fld.setAccessible(true);
                        if (fld.get(this) == null) {
                                fld.set(this,new ParamEncoder(this.id + this.tableId));
                        }
                } catch (SecurityException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (NoSuchFieldException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IllegalArgumentException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IllegalAccessException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                this.tableId = tableId;
                

        }
        

        
}



---------------------------------------------------------------------
JIRA INFORMATION:
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

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to