You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Trygve Hardersen <ts...@sl.cbs.dk> on 2004/07/13 14:24:55 UTC

logic:iterate fails on (large) collection

Hello there
This is driving me mad, any help or hints are much appreciated. I have a
page that iterates through a collection of simple objects, and lists
them for users to select some of them (checkbox), edit a property and
submit the results (much like an inbox). This works great, when the list
has less than 10 elements, or the iteration is limited by using the
length property of the logic:iterate tag. When there are more than 10
elements, the iteration stops on the middle of writing html. The stop
point is not consistent; sometimes it writes the complete 10th element,
but no 11th, other times half of the 11th element is written. The
generated HTML page is invalid, indicated by a sudden abruption in the
middle of a tag (<td> without >, or a half written URL). I have tried
with different data, the same error occurs, and I cannot find anything
wrong with the objects in the list. However, I have the same page
displaying a large set of objects where none have selected checkboxes.
Is there a size limit on the indexed html list, in relation to
checkboxes? I can't find any error messages in the log or at the
generated page. This is the page code:

<%@ include file="/common/taglibs.jsp"%>
<html:form action="/dibs/captureDibs">
<table class="tabT">
	<tr>
		<td class="tabHed" colspan="8">
		<logic:empty name="dibsOrderList" property="orders"
scope="session">
			<bean:message key="dibsOrderList.noneFound"/>
		</logic:empty>
		<logic:notEmpty name="dibsOrderList" property="orders"
scope="session">
		<logic:notEmpty name="tableMessages">
		<html:messages id="message" name="tableMessages">
			<bean:write name="message" filter="false"/><br/>
		</html:messages>
		</logic:notEmpty>
		<logic:empty name="tableMessages">
        	<bean:message key="dibsOrder.listMessage"/>
		</logic:empty>
		</logic:notEmpty>
		</td>
	</tr>
	<tr>
		<td class="tabHed" width="15%">
			<bean:message key="dibsOrder.oaseOrder"/>
		</td>
		<td class="tabHed" width="15%">
			<bean:message key="dibsOrder.wwwOrder"/>
		</td>
		<td class="tabHed" width="15%">
			<bean:message key="dibsOrder.dibsOrder"/>
		</td>
		<td class="tabHed" width="15%">
			<bean:message key="dibsOrder.booked"/>
		</td>
		<td class="tabHed" width="10%">
			<bean:message key="dibsOrder.authAmount"/>
		</td>
		<td class="tabHed" width="10%">
			<bean:message key="dibsOrder.oaseAmount"/>
		</td>
		<td class="tabHed" width="15%">
			<bean:message key="dibsOrder.status"/>
		</td>
		<td class="tabHed" width="5%">
			<bean:message key="dibsOrder.mark"/>
		</td>
	</tr>
	<!--<logic:notEmpty name="dibsOrderList" property="orders"
scope="session">-->
	<logic:iterate id="orders" name="dibsOrderList"
property="orders" scope="session">
	<tr>
		<td>
		<html:link forward="oase.order.editOrder" paramId="id"
paramName="orders" paramProperty="oaseId">
			<bean:write name="orders" property="oaseId"/>
		</html:link>
		</td>
		<td>
		<html:link forward="web.editOrder"  name="orders"
property="webOrderParameters" target="webWindow">
			<bean:write name="orders" property="webId"/>
		</html:link>
		</td>
		<td>
		<html:link forward="dibsdibs.editOrder"
paramId="transact" paramName="orders" paramProperty="dibsId"
target="dibsWindow">
			<bean:write name="orders" property="dibsId"/>
		</html:link>
		</td>
		<td>
		<logic:notEmpty name="orders" property="bookingDate">
			<fmt:formatDate type="date"
dateStyle="${initParam.dateFormat}" value="${orders.bookingDate}"/>
		</logic:notEmpty>
		<logic:empty name="orders" property="bookingDate">
			<logic:notEmpty name="orders"
property="orderDate">
			<fmt:formatDate type="date"
dateStyle="${initParam.dateFormat}" value="${orders.orderDate}"/>
			</logic:notEmpty>
		</logic:empty>
		</td>
		<td>
		<logic:notEmpty name="orders" property="authAmount">
			<fmt:formatNumber
minFractionDigits="${initParam.moneyMinFractions}"
maxFractionDigits="${initParam.moneyMaxFractions}"
value="${orders.authAmount}"/>
		</logic:notEmpty>
		</td>
		<td>
		<logic:notEmpty name="orders" property="oaseSum">
			<fmt:formatNumber
minFractionDigits="${initParam.moneyMinFractions}"
maxFractionDigits="${initParam.moneyMaxFractions}"
value="${orders.oaseSum}" var="bookedSum"/>
			<html:text name="orders" property="oaseSum"
value="${bookedSum}" indexed="true" size="10"/>
		</logic:notEmpty>
		</td>
		<td>
			<bean:message name="orders" property="status"/>
		</td>
		<td>
			<html:checkbox name="orders" property="capture"
indexed="true" value="true"/>
		</td>
	</tr>
	</logic:iterate>
	<!--</logic:notEmpty>-->
	<tr>
    	<td colspan="4">
        <html:submit styleClass="button" property="action">
			<fmt:message key="button.capture"/>
        </html:submit>
        </td>
        <td colspan="4">
        <html:button styleClass="button" property="action"
onclick="cancel(this.form)">
            <fmt:message key="button.cancel"/>
        </html:button>
        </td>
    </tr>
</table>
</html:form>
<script type="text/javascript">
function cancel(form) {
    location.href = '<html:rewrite forward="main"/>';
}
</script>

Any ideas?

Thanks and regards
Trygve Hardersen


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


Re: logic:iterate fails on (large) collection

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
At 05:24 AM 7/13/2004, you wrote:
>This is the page code:
>
><%@ include file="/common/taglibs.jsp"%>


As you can see, this is not enough info.  You might want to substitute 
escape characters for the html?




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


Re: logic:iterate fails on (large) collection

Posted by Bill Siggelkow <bi...@bellsouth.net>.
Oops -- my bad -- the JSP comments are balanced <%-- --%>

Bill Siggelkow wrote:

> It is not the size of the collection you are having the problem with but 
> more likely it is data-related. Make sure you view the source that gets 
> generated -- that will usually clue you into the offending data.
> 
> Hmm -- I noticed that you are using HTML comments <!-- --> around some 
> of your <logic:notEmpty> tags.
> Keep in mind that HTML comments *do not* prevent translation of the tags 
> within the comments. If you truly want to comment out the tags you need 
> to use JSP comments <%-- -->
> 


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


Re: logic:iterate fails on (large) collection

Posted by Bill Siggelkow <bi...@bellsouth.net>.
It is not the size of the collection you are having the problem with but 
more likely it is data-related. Make sure you view the source that gets 
generated -- that will usually clue you into the offending data.

Hmm -- I noticed that you are using HTML comments <!-- --> around some 
of your <logic:notEmpty> tags.
Keep in mind that HTML comments *do not* prevent translation of the tags 
within the comments. If you truly want to comment out the tags you need 
to use JSP comments <%-- -->

Trygve Hardersen wrote:

> Hello there
> This is driving me mad, any help or hints are much appreciated. I have a
> page that iterates through a collection of simple objects, and lists
> them for users to select some of them (checkbox), edit a property and
> submit the results (much like an inbox). This works great, when the list
> has less than 10 elements, or the iteration is limited by using the
> length property of the logic:iterate tag. When there are more than 10
> elements, the iteration stops on the middle of writing html. The stop
> point is not consistent; sometimes it writes the complete 10th element,
> but no 11th, other times half of the 11th element is written. The
> generated HTML page is invalid, indicated by a sudden abruption in the
> middle of a tag (<td> without >, or a half written URL). I have tried
> with different data, the same error occurs, and I cannot find anything
> wrong with the objects in the list. However, I have the same page
> displaying a large set of objects where none have selected checkboxes.
> Is there a size limit on the indexed html list, in relation to
> checkboxes? I can't find any error messages in the log or at the
> generated page. This is the page code:
> 
> <%@ include file="/common/taglibs.jsp"%>
> <html:form action="/dibs/captureDibs">
> <table class="tabT">
> 	<tr>
> 		<td class="tabHed" colspan="8">
> 		<logic:empty name="dibsOrderList" property="orders"
> scope="session">
> 			<bean:message key="dibsOrderList.noneFound"/>
> 		</logic:empty>
> 		<logic:notEmpty name="dibsOrderList" property="orders"
> scope="session">
> 		<logic:notEmpty name="tableMessages">
> 		<html:messages id="message" name="tableMessages">
> 			<bean:write name="message" filter="false"/><br/>
> 		</html:messages>
> 		</logic:notEmpty>
> 		<logic:empty name="tableMessages">
>         	<bean:message key="dibsOrder.listMessage"/>
> 		</logic:empty>
> 		</logic:notEmpty>
> 		</td>
> 	</tr>
> 	<tr>
> 		<td class="tabHed" width="15%">
> 			<bean:message key="dibsOrder.oaseOrder"/>
> 		</td>
> 		<td class="tabHed" width="15%">
> 			<bean:message key="dibsOrder.wwwOrder"/>
> 		</td>
> 		<td class="tabHed" width="15%">
> 			<bean:message key="dibsOrder.dibsOrder"/>
> 		</td>
> 		<td class="tabHed" width="15%">
> 			<bean:message key="dibsOrder.booked"/>
> 		</td>
> 		<td class="tabHed" width="10%">
> 			<bean:message key="dibsOrder.authAmount"/>
> 		</td>
> 		<td class="tabHed" width="10%">
> 			<bean:message key="dibsOrder.oaseAmount"/>
> 		</td>
> 		<td class="tabHed" width="15%">
> 			<bean:message key="dibsOrder.status"/>
> 		</td>
> 		<td class="tabHed" width="5%">
> 			<bean:message key="dibsOrder.mark"/>
> 		</td>
> 	</tr>
> 	<!--<logic:notEmpty name="dibsOrderList" property="orders"
> scope="session">-->
> 	<logic:iterate id="orders" name="dibsOrderList"
> property="orders" scope="session">
> 	<tr>
> 		<td>
> 		<html:link forward="oase.order.editOrder" paramId="id"
> paramName="orders" paramProperty="oaseId">
> 			<bean:write name="orders" property="oaseId"/>
> 		</html:link>
> 		</td>
> 		<td>
> 		<html:link forward="web.editOrder"  name="orders"
> property="webOrderParameters" target="webWindow">
> 			<bean:write name="orders" property="webId"/>
> 		</html:link>
> 		</td>
> 		<td>
> 		<html:link forward="dibsdibs.editOrder"
> paramId="transact" paramName="orders" paramProperty="dibsId"
> target="dibsWindow">
> 			<bean:write name="orders" property="dibsId"/>
> 		</html:link>
> 		</td>
> 		<td>
> 		<logic:notEmpty name="orders" property="bookingDate">
> 			<fmt:formatDate type="date"
> dateStyle="${initParam.dateFormat}" value="${orders.bookingDate}"/>
> 		</logic:notEmpty>
> 		<logic:empty name="orders" property="bookingDate">
> 			<logic:notEmpty name="orders"
> property="orderDate">
> 			<fmt:formatDate type="date"
> dateStyle="${initParam.dateFormat}" value="${orders.orderDate}"/>
> 			</logic:notEmpty>
> 		</logic:empty>
> 		</td>
> 		<td>
> 		<logic:notEmpty name="orders" property="authAmount">
> 			<fmt:formatNumber
> minFractionDigits="${initParam.moneyMinFractions}"
> maxFractionDigits="${initParam.moneyMaxFractions}"
> value="${orders.authAmount}"/>
> 		</logic:notEmpty>
> 		</td>
> 		<td>
> 		<logic:notEmpty name="orders" property="oaseSum">
> 			<fmt:formatNumber
> minFractionDigits="${initParam.moneyMinFractions}"
> maxFractionDigits="${initParam.moneyMaxFractions}"
> value="${orders.oaseSum}" var="bookedSum"/>
> 			<html:text name="orders" property="oaseSum"
> value="${bookedSum}" indexed="true" size="10"/>
> 		</logic:notEmpty>
> 		</td>
> 		<td>
> 			<bean:message name="orders" property="status"/>
> 		</td>
> 		<td>
> 			<html:checkbox name="orders" property="capture"
> indexed="true" value="true"/>
> 		</td>
> 	</tr>
> 	</logic:iterate>
> 	<!--</logic:notEmpty>-->
> 	<tr>
>     	<td colspan="4">
>         <html:submit styleClass="button" property="action">
> 			<fmt:message key="button.capture"/>
>         </html:submit>
>         </td>
>         <td colspan="4">
>         <html:button styleClass="button" property="action"
> onclick="cancel(this.form)">
>             <fmt:message key="button.cancel"/>
>         </html:button>
>         </td>
>     </tr>
> </table>
> </html:form>
> <script type="text/javascript">
> function cancel(form) {
>     location.href = '<html:rewrite forward="main"/>';
> }
> </script>
> 
> Any ideas?
> 
> Thanks and regards
> Trygve Hardersen


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


RE: logic:iterate fails on (large) collection

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
only a quick hint.

did you look into displaytags ?
-->http://displaytag.sourceforge.net/

i usem them for iterating. since they create HTML as well

hope it helps (abit...)



> -----Original Message-----
> From: Trygve Hardersen [mailto:tsh@sl.cbs.dk] 
> Sent: Tuesday, July 13, 2004 2:25 PM
> To: user@struts.apache.org
> Subject: logic:iterate fails on (large) collection
> 
> 
> Hello there
> This is driving me mad, any help or hints are much 
> appreciated. I have a page that iterates through a collection 
> of simple objects, and lists them for users to select some of 
> them (checkbox), edit a property and submit the results (much 
> like an inbox). This works great, when the list has less than 
> 10 elements, or the iteration is limited by using the length 
> property of the logic:iterate tag. When there are more than 
> 10 elements, the iteration stops on the middle of writing 
> html. The stop point is not consistent; sometimes it writes 
> the complete 10th element, but no 11th, other times half of 
> the 11th element is written. The generated HTML page is 
> invalid, indicated by a sudden abruption in the middle of a 
> tag (<td> without >, or a half written URL). I have tried 
> with different data, the same error occurs, and I cannot find 
> anything wrong with the objects in the list. However, I have 
> the same page displaying a large set of objects where none 
> have selected checkboxes. Is there a size limit on the 
> indexed html list, in relation to checkboxes? I can't find 
> any error messages in the log or at the generated page. This 
> is the page code:
> 
> <%@ include file="/common/taglibs.jsp"%>
> <html:form action="/dibs/captureDibs">
> <table class="tabT">
> 	<tr>
> 		<td class="tabHed" colspan="8">
> 		<logic:empty name="dibsOrderList" 
> property="orders" scope="session">
> 			<bean:message key="dibsOrderList.noneFound"/>
> 		</logic:empty>
> 		<logic:notEmpty name="dibsOrderList" 
> property="orders" scope="session">
> 		<logic:notEmpty name="tableMessages">
> 		<html:messages id="message" name="tableMessages">
> 			<bean:write name="message" filter="false"/><br/>
> 		</html:messages>
> 		</logic:notEmpty>
> 		<logic:empty name="tableMessages">
>         	<bean:message key="dibsOrder.listMessage"/>
> 		</logic:empty>
> 		</logic:notEmpty>
> 		</td>
> 	</tr>
> 	<tr>
> 		<td class="tabHed" width="15%">
> 			<bean:message key="dibsOrder.oaseOrder"/>
> 		</td>
> 		<td class="tabHed" width="15%">
> 			<bean:message key="dibsOrder.wwwOrder"/>
> 		</td>
> 		<td class="tabHed" width="15%">
> 			<bean:message key="dibsOrder.dibsOrder"/>
> 		</td>
> 		<td class="tabHed" width="15%">
> 			<bean:message key="dibsOrder.booked"/>
> 		</td>
> 		<td class="tabHed" width="10%">
> 			<bean:message key="dibsOrder.authAmount"/>
> 		</td>
> 		<td class="tabHed" width="10%">
> 			<bean:message key="dibsOrder.oaseAmount"/>
> 		</td>
> 		<td class="tabHed" width="15%">
> 			<bean:message key="dibsOrder.status"/>
> 		</td>
> 		<td class="tabHed" width="5%">
> 			<bean:message key="dibsOrder.mark"/>
> 		</td>
> 	</tr>
> 	<!--<logic:notEmpty name="dibsOrderList" 
> property="orders" scope="session">-->
> 	<logic:iterate id="orders" name="dibsOrderList" 
> property="orders" scope="session">
> 	<tr>
> 		<td>
> 		<html:link forward="oase.order.editOrder" 
> paramId="id" paramName="orders" paramProperty="oaseId">
> 			<bean:write name="orders" property="oaseId"/>
> 		</html:link>
> 		</td>
> 		<td>
> 		<html:link forward="web.editOrder"  
> name="orders" property="webOrderParameters" target="webWindow">
> 			<bean:write name="orders" property="webId"/>
> 		</html:link>
> 		</td>
> 		<td>
> 		<html:link forward="dibsdibs.editOrder"
> paramId="transact" paramName="orders" paramProperty="dibsId" 
> target="dibsWindow">
> 			<bean:write name="orders" property="dibsId"/>
> 		</html:link>
> 		</td>
> 		<td>
> 		<logic:notEmpty name="orders" property="bookingDate">
> 			<fmt:formatDate type="date" 
> dateStyle="${initParam.dateFormat}" value="${orders.bookingDate}"/>
> 		</logic:notEmpty>
> 		<logic:empty name="orders" property="bookingDate">
> 			<logic:notEmpty name="orders"
> property="orderDate">
> 			<fmt:formatDate type="date" 
> dateStyle="${initParam.dateFormat}" value="${orders.orderDate}"/>
> 			</logic:notEmpty>
> 		</logic:empty>
> 		</td>
> 		<td>
> 		<logic:notEmpty name="orders" property="authAmount">
> 			<fmt:formatNumber 
> minFractionDigits="${initParam.moneyMinFractions}"
> maxFractionDigits="${initParam.moneyMaxFractions}"
> value="${orders.authAmount}"/>
> 		</logic:notEmpty>
> 		</td>
> 		<td>
> 		<logic:notEmpty name="orders" property="oaseSum">
> 			<fmt:formatNumber 
> minFractionDigits="${initParam.moneyMinFractions}"
> maxFractionDigits="${initParam.moneyMaxFractions}"
> value="${orders.oaseSum}" var="bookedSum"/>
> 			<html:text name="orders" 
> property="oaseSum" value="${bookedSum}" indexed="true" size="10"/>
> 		</logic:notEmpty>
> 		</td>
> 		<td>
> 			<bean:message name="orders" property="status"/>
> 		</td>
> 		<td>
> 			<html:checkbox name="orders" 
> property="capture" indexed="true" value="true"/>
> 		</td>
> 	</tr>
> 	</logic:iterate>
> 	<!--</logic:notEmpty>-->
> 	<tr>
>     	<td colspan="4">
>         <html:submit styleClass="button" property="action">
> 			<fmt:message key="button.capture"/>
>         </html:submit>
>         </td>
>         <td colspan="4">
>         <html:button styleClass="button" property="action" 
> onclick="cancel(this.form)">
>             <fmt:message key="button.cancel"/>
>         </html:button>
>         </td>
>     </tr>
> </table>
> </html:form>
> <script type="text/javascript">
> function cancel(form) {
>     location.href = '<html:rewrite forward="main"/>';
> }
> </script>
> 
> Any ideas?
> 
> Thanks and regards
> Trygve Hardersen
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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