You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Roger Kjensrud <rk...@CJ.COM> on 2001/02/05 23:54:13 UTC
Problems with iterate tag
Hello,
I'm trying to use the iterate tag to access a Model object that contains an ArrayList. The ArrayList in turn contains objects containing the data I would like to present to the user. However, I can't get it to work. Here's the code that works:
<%
LinkModel model = (LinkModel)request.getAttribute("linkModel");
ArrayList rs = model.getResultSet();
LinkQueryForm lqForm = (LinkQueryForm)rs.get(0);
%>
Affiliate ID: <%=lqForm.getAffiliateId()%>
Integer ID: <%=lqForm.getIntegerId()%>
In the Action class, I do the following:
request.setAttribute("linkModel", linkModel), where linkModel is an instance of the LinkModel class.
I thought by using the iterate tag, the following should work:
<logic:iterate id="linkQueryForm" name="linkModel" property="resultSet">
<tr>
<td align="left">
<bean:write name="linkQueryForm" property="affiliateId" filter="true"/>
</td>
<td align="left">
<bean:write name="linkQueryForm" property="categoryId" filter="true"/>
</td>
<td align="left">
<bean:write name="linkQueryForm" property="integerId" filter="true"/>
</td>
</tr>
</logic:iterate>
However, I get the following error:
No getter method for bean linkModel and property resultSet
Well, the the LinkModel contains the getResultSet() method, so I'm little puzzled here... I'm using the latest nightly build.
Any thoughts would be appreciated!!
Thanks,
Roger Kjensrud
Re: Problems with iterate tag
Posted by Chris Evans <ch...@canlink.com>.
I don't see a <jsp:useBean /> tag in your code???
Something like this...
<jsp:useBean
id="linkModel"
scope="request"
class="blah.blah.blah.FormName"
/>
----- Original Message -----
From: "Roger Kjensrud" <rk...@CJ.COM>
To: <st...@jakarta.apache.org>
Sent: Monday, February 05, 2001 5:54 PM
Subject: Problems with iterate tag
Hello,
I'm trying to use the iterate tag to access a Model object that contains an
ArrayList. The ArrayList in turn contains objects containing the data I
would like to present to the user. However, I can't get it to work. Here's
the code that works:
<%
LinkModel model = (LinkModel)request.getAttribute("linkModel");
ArrayList rs = model.getResultSet();
LinkQueryForm lqForm = (LinkQueryForm)rs.get(0);
%>
Affiliate ID: <%=lqForm.getAffiliateId()%>
Integer ID: <%=lqForm.getIntegerId()%>
In the Action class, I do the following:
request.setAttribute("linkModel", linkModel), where linkModel is an instance
of the LinkModel class.
I thought by using the iterate tag, the following should work:
<logic:iterate id="linkQueryForm" name="linkModel" property="resultSet">
<tr>
<td align="left">
<bean:write name="linkQueryForm" property="affiliateId" filter="true"/>
</td>
<td align="left">
<bean:write name="linkQueryForm" property="categoryId" filter="true"/>
</td>
<td align="left">
<bean:write name="linkQueryForm" property="integerId" filter="true"/>
</td>
</tr>
</logic:iterate>
However, I get the following error:
No getter method for bean linkModel and property resultSet
Well, the the LinkModel contains the getResultSet() method, so I'm little
puzzled here... I'm using the latest nightly build.
Any thoughts would be appreciated!!
Thanks,
Roger Kjensrud