Dean,

There is nothing inherently wrong with what you're doing. Below is a file that creates a number of Ride objects, uses your exact table structure and means of conversion, to the point that I created a HashSet, stored the objects there, then converted that to a list, just to see if there was anything weird in that process. This displays and pages just fine. I've also attached my little Sandbox app that you can plop into your app server to check it out (it's not a very well-behaved war file, since I've removed all the libraries to save space; look at web-inf/lib/libraries.txt for a list of the jar files that should be included).

I'm wondering if the problem is in the Hibernate lazy retrieval mechanism. That is, the dao object only returns a page, then, when display tag tries to get the next page, it's just not there? I dunno. I'd try faking up your result set much like I did with this example and see if it works when you remove the Hibernate functionality. In that case, the error would be on the data-handling side of the equation and not the display tag side.

<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%@ page import="test.Ride,java.util.*" errorPage="" %>
<%@ taglib uri="/WEB-INF/tlds/displaytag-el-12.tld" prefix="display" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>

<%
   long time = 1114118097301l;
   Ride ride1 = new Ride("A", new Date(time), 1234, 1234, 1234);
   Ride ride2 = new Ride("B", new Date(time += 100), 2345, 2345, 2345);
   Ride ride3 = new Ride("C", new Date(time += 100), 3456, 3456, 3456);
   Ride ride4 = new Ride("D", new Date(time += 100), 3456, 3456, 3456);
   Ride ride5 = new Ride("E", new Date(time += 100), 3456, 3456, 3456);
   Ride ride6 = new Ride("F", new Date(time += 100), 3456, 3456, 3456);
   Ride ride7 = new Ride("G", new Date(time += 100), 3456, 3456, 3456);
   Ride ride8 = new Ride("H", new Date(time += 100), 3456, 3456, 3456);
   Ride ride9 = new Ride("I", new Date(time += 100), 3456, 3456, 3456);
   Ride ride10 = new Ride("J", new Date(time += 100), 3456, 3456, 3456);
   Ride ride11 = new Ride("K", new Date(time += 100), 3456, 3456, 3456);
   Ride ride12 = new Ride("L", new Date(time += 100), 3456, 3456, 3456);
   Ride ride13 = new Ride("M", new Date(time += 100), 3456, 3456, 3456);
   Ride ride14 = new Ride("N", new Date(time += 100), 3456, 3456, 3456);
   Ride ride15 = new Ride("O", new Date(time += 100), 3456, 3456, 3456);
   Ride ride16 = new Ride("P", new Date(time += 100), 3456, 3456, 3456);
   Ride ride17 = new Ride("Q", new Date(time += 100), 3456, 3456, 3456);
   Ride ride18 = new Ride("R", new Date(time += 100), 3456, 3456, 3456);
   Ride ride19 = new Ride("S", new Date(time += 100), 3456, 3456, 3456);

   Set rides = new HashSet();
   rides.add(ride1);
   rides.add(ride2);
   rides.add(ride3);
   rides.add(ride4);
   rides.add(ride5);
   rides.add(ride6);
   rides.add(ride7);
   rides.add(ride8);
   rides.add(ride9);
   rides.add(ride10);
   rides.add(ride11);
   rides.add(ride12);
   rides.add(ride13);
   rides.add(ride14);
   rides.add(ride15);
   rides.add(ride16);
   rides.add(ride17);
   rides.add(ride18);
   rides.add(ride19);
   System.out.println("rides.size(): " + rides.size());
   Iterator i = rides.iterator();

   ArrayList arr = new ArrayList();
   while(i.hasNext())
   {
       Object o = i.next();
       System.out.println("Adding " + o.toString());
       arr.add(o);
   }

   request.setAttribute("Rides", arr);
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<logic:present scope="request" name="Rides">
   <display:table name="Rides" pagesize="10" >
       <display:column property="date" />
       <display:column property="route" />
       <display:column property="dst" />
   </display:table>
</logic:present>

</body>
</html>



Dean Crothers wrote:

Rick,

I'm using hibernate V2 to populate the Set. To remove the Set issue you spoke of, I then convert the Set to a java.util.ArrayList and set it as an attribute on the http request, the code fragment being:

                       Set rides = dao.getAllRides();
            Iterator i = rides.iterator();
            ArrayList arr = new ArrayList();
            while(i.hasNext()) {
                arr.add(i.next());
            }
            req.setAttribute("Rides", arr);

The ArrayList is composed of Ride objects, being:

import java.util.Date;

public class Ride {
   private int id;
   private String route;
   private Date date;
   private int dst;
   private int duration;
   private int odo;
   private Bike bike;


public Ride() {}

   public Ride(String route, Date date, int dst, int duration, int odo) {
       setRoute(route);
       setDate(date);
       setDst(dst);
       setDuration(duration);
       setOdo(odo);
   }

   public int getId() {
       return id;
   }

   public String getRoute() {
       return route;
   }

   public Date getDate() {
       return date;
   }

   public int getDst() {
       return dst;
   }

   public int getDuration() {
       return duration;
   }

   public int getOdo() {
       return odo;
   }

   public Bike getBike() {
       return bike;
   }

   public void setId(int id) {
       this.id = id;
   }

   public void setRoute(String route) {
       this.route = route;
   }

   public void setDate(Date date) {
       this.date = date;
   }

   public void setDst(int dst) {
       this.dst = dst;
   }

   public void setDuration(int duration) {
       this.duration = duration;
   }

   public void setOdo(int odo) {
       this.odo = odo;
   }

   public void setBike(Bike bike) {
       this.bike = bike;
   }

   public String toString() {
       return date + " " + route;
   }

   public boolean equals(Object other) {
       if ( this == other ) {
           return true;
       }
       if ( !(other instanceof Ride) ) {
           return false;
       }
       if ( this.getId() == ((Ride)other).getId() ) {
           return true;
       }
       return false;
   }

   public int hashCode() {
       return 12; // legal but very inefficient
   }
}


Then finally the JSP code to render the table is (and I've tried various forms of this) to no avail:

<%@ taglib uri="http://displaytag.sf.net"; prefix="display" %>
...
    <logic:present scope="request" name="Rides">
        <display:table name="Rides" pagesize="10" >
            <display:column property="date" />
            <display:column property="route" />
            <display:column property="dst" />
        </display:table>
    </logic:present>


As I've said the first 10 records are displayed fine, but when I click 'Next', 'Last', etc it throws the exception. I've removed the acegi security and that wasnt it, so I think this is as about as simple as it can be, so its a little puzzling as to whats going on? I'm using Tiles but I cant see how that could be it?

thanks for your time,

Dean

----Original Message Follows----
From: Rick Herrick <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: [displaytag-user] Jasper exception?
Date: Thu, 21 Apr 2005 11:35:36 -0700

Sorry, you've stumped me then! I really have issues with the error reporting from within the Tomcat engine, precisely for this reason. It's quite difficult to figure out precisely what's making it mad.

If you can post a snippet of how the list is getting populated and what it's getting populated with, that may provide some more information, but this is one of those more difficult things to figure out...

Dean Crothers wrote:

Rick,

thanks for the suggestion, but I've changed it to an implementation of java.util.ArrayList and I'm still getting the same exception.


Dean

----Original Message Follows----
From: "Dean Crothers" <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: [displaytag-user] Jasper exception?
Date: Thu, 21 Apr 2005 07:59:58 +0000

Hi,

I have a problem that I cant find the answer to in the forums archives. The first 10 records displays fine in the table, however when I click 'Next' I get a jasper exception. I'm using Tomcat 4.1.31, Spring 1.1.5, Struts 1.2.4, DisplayTag-1.0, all the correct commons-* dependences as I copied them from the example webapp.

Any help is appreciated!

My displayTag JSP code is:
        <display:table name="Rides" pagesize="10">
            <display:column property="date" title="Date" />
            <display:column property="route" title="Route" />
            <display:column property="dst" title="DST" />
        </display:table>

where "Rides" is an instance of java.util.HashSet, and the exception is:

HTTP Status 500 -

--------------------------------------------------------------------------------



type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException
at net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter.doFilter(SecurityEnforcementFilter.java:214)


at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)


at net.sf.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:374)


at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)


at net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:225)


at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)


at net.sf.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:179)


at net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:125)


at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166)


at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)


at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)


at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)


at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)


at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)


at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)


at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)


at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)


at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)


at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)


at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)


at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)


at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)


at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)


at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)


at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)


at java.lang.Thread.run(Unknown Source)


root cause

org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:207)


at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)


at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)


at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:300)


at net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:84)


at net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter.doFilter(SecurityEnforcementFilter.java:182)


at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)


at net.sf.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:374)


at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)


at net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:225)


at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)


at net.sf.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:179)


at net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:125)


at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166)


at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)


at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)


at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)


at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)


at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)


at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)


at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)


at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)


at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)


at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)


at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)


at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)


at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)


at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)


at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)


at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)


at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)


at java.lang.Thread.run(Unknown Source)



-- Rick Herrick [EMAIL PROTECTED]

I haven't got time for inner peace.

Get out of control, but appear under control. It's not bad to alarm other people, though--it's good for them.--Hunter S. Thompson




------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ displaytag-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/displaytag-user




------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ displaytag-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/displaytag-user



-- Rick Herrick [EMAIL PROTECTED]

I haven't got time for inner peace.

Get out of control, but appear under control. It's not bad to alarm other 
people, though--it's good for them.--Hunter S. Thompson



Attachment: Sandbox.war
Description: Binary data

Reply via email to