Struts/JSP: logic.iterate strangeness

A

Angus McIntyre

I have a JSP that contains the following fragment:


<%
com.example.bbfront.Segment[] segments =
(com.example.model.Segment[])
session.getAttribute("segments");
%>

<table>
<logic:iterate id="segment"
collection="<%= segments %>"
type="com.example.model.SegmentImpl">
<tr>
<td><bean:write name="segment" property="id" /></td>
<td><bean:write name="segment" property="price" /></td>
</tr>
</logic:iterate>
</table>

The 'segments' attribute is bound to an array of Segment (Segment is an
interface, SegmentImpl is a class implementing that interface).

If I invoke this with a single element in the array, the id and price of
the segment are printed out in the page just as I would hope and expect.

If I invoke it with two or more elements in the array, the JSP fails
with an error message that signals a 'root cause'

Cannot find bean segment in any scope

This seems a little bizarre to me. Can anyone offer any suggestions, or
point out the obvious mistake?

Thanks,

Angus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top