The following comment has been added to this issue:

     Author: Keith Garry Boyce
    Created: Wed, 20 Oct 2004 12:20 AM
       Body:
To qualify. I'm not having classcast. I'm having original problem in that the three 
tables still do not sort independently.
---------------------------------------------------------------------
View this comment:
  http://jira.codehaus.org/browse/DISPL-56?page=comments#action_25594

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

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: DISPL-56
    Summary: Multiple tables on one page is not working
       Type: Bug

     Status: Unassigned
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

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

   Assignee: 
   Reporter: Keith Garry Boyce

    Created: Sun, 10 Oct 2004 7:48 AM
    Updated: Wed, 20 Oct 2004 12:20 AM

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: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to