You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Aaron Humphrey <Hu...@Kakari.com> on 2003/07/21 19:57:49 UTC

logic:iterate tag fails on large dataset, succeeds on small one?

I am trying to do a very simple data-display web application using Struts, with MySQL on the
back end.

Basically, I take a ResultSet and its ResultSetMetaData and put it into some beans.  I have a
TableDataView object which contains a FieldList and a RecordCollection.  FieldList has a property
called fields which returns a List.  RecordCollection implements Collection, and containts an
ArrayList of Record objects; Record returns an array of the field value objects as the property
fieldValues.

My JSP page(showtable.jsp)looks like:

<html:html>
<TABLE>
<TR>
<logic:iterate id="fields" name="tableDataView" property="fieldList">
<TH><bean:write name="fields" /></TH>
</logic:iterate>
</TR>
<logic:iterate id="record" name="tableDataView" property="recordList">
<TR>
<logic:iterate id="fvalues" name="record" property="fieldValues">
<TD><bean:write name="fvalues" /></TD>
</logic:iterate>
</TR>
</logic:iterate>
</TABLE>
</html:html>

If I run this on a small table, with 10 fields and 11 records, it works fine.  If I run it on a
large table, with 28 fields and 307 records, then I get:

javax.servlet.ServletException: cannot find bean fvalues in any scope
        at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon
textImpl.java:533)
        at org.apache.jsp.showtable_jsp._jspService(showtable_jsp.java:192)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
...[deletia...I can't imagine that any of it has anything to do with my error]
        at java.lang.Thread.run(Thread.java:536)

I can eliminate this problem if I reduce the number of fields in the table to 9 or 10,
but I can't see why this should be a problem, and certainly not why my looping bean
should suddenly become unavailable.  My unit tests seem to be telling me that my
Record bean should be properly returning a list of 28 field values.  I don't know at
what point things are breaking down.  I'm not experienced with JSP tag programming,
so I haven't been able to learn much from IterateTag.java, or the compiled version
of showtable.jsp.  Any pointers on my problem would be much appreciated.




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: logic:iterate tag fails on large dataset, succeeds on small one?

Posted by David Graham <gr...@yahoo.com>.
I suggest you use the JSTL's <c:forEach> tag instead of the Struts iterate
tag.  I have dynamic query pages that use forEach and display n number of
fields with no problem.  As an added bonus you'll get improved page
rendering time because containers can optimize the performance of JSTL
tags.

David


--- Aaron Humphrey <Hu...@Kakari.com> wrote:
> 
> I am trying to do a very simple data-display web application using
> Struts, with MySQL on the
> back end.
> 
> Basically, I take a ResultSet and its ResultSetMetaData and put it into
> some beans.  I have a
> TableDataView object which contains a FieldList and a RecordCollection. 
> FieldList has a property
> called fields which returns a List.  RecordCollection implements
> Collection, and containts an
> ArrayList of Record objects; Record returns an array of the field value
> objects as the property
> fieldValues.
> 
> My JSP page(showtable.jsp)looks like:
> 
> <html:html>
> <TABLE>
> <TR>
> <logic:iterate id="fields" name="tableDataView" property="fieldList">
> <TH><bean:write name="fields" /></TH>
> </logic:iterate>
> </TR>
> <logic:iterate id="record" name="tableDataView" property="recordList">
> <TR>
> <logic:iterate id="fvalues" name="record" property="fieldValues">
> <TD><bean:write name="fvalues" /></TD>
> </logic:iterate>
> </TR>
> </logic:iterate>
> </TABLE>
> </html:html>
> 
> If I run this on a small table, with 10 fields and 11 records, it works
> fine.  If I run it on a
> large table, with 28 fields and 307 records, then I get:
> 
> javax.servlet.ServletException: cannot find bean fvalues in any scope
>         at
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon
> textImpl.java:533)
>         at
> org.apache.jsp.showtable_jsp._jspService(showtable_jsp.java:192)
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
> ...[deletia...I can't imagine that any of it has anything to do with my
> error]
>         at java.lang.Thread.run(Thread.java:536)
> 
> I can eliminate this problem if I reduce the number of fields in the
> table to 9 or 10,
> but I can't see why this should be a problem, and certainly not why my
> looping bean
> should suddenly become unavailable.  My unit tests seem to be telling me
> that my
> Record bean should be properly returning a list of 28 field values.  I
> don't know at
> what point things are breaking down.  I'm not experienced with JSP tag
> programming,
> so I haven't been able to learn much from IterateTag.java, or the
> compiled version
> of showtable.jsp.  Any pointers on my problem would be much appreciated.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org