Nah, he's got that part right....it's a Collection of TestData objects, and TestData has a getData() method.
Karl, this looks right to me....u sure you don't have an old JSP (different from below) in your web server that you're testing against or something? > -----Original Message----- > From: James Mitchell [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 04, 2003 8:22 PM > To: 'Struts Users Mailing List' > Subject: RE: Problems with the iterate tag > > > Why are you specifying property="data"? > > > <bean:write name="element" property="data"/>.<br/> > ^^^^^^^^^^^^^^^ > > Try removing that. > > -- > James Mitchell > Web Developer/Struts Evangelist > http://jakarta.apache.org/struts/ > > "People demand freedom of speech to make up for the freedom of thought > which they avoid." > - Soren Aabye Kierkegaard (1813-1855) > > > > > > -----Original Message----- > > From: Karl [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, March 04, 2003 11:16 PM > > To: Struts Users Mailing List > > Subject: Problems with the iterate tag > > > > > > I'm trying to get my jsp page to iterate over a collection of > > objects, > > printing one object property (data) on every line. > > > > I've tried implementing the following: > > > > test.jsp: > > vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> > > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> > > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> > > > > <html:html> > > <head> > > <title>Test</title> > > </head> > > <body> > > <logic:iterate id="element" name="testContainer" > > property="testData"> > > <bean:write name="element" property="data"/>.<br/> > > </logic:iterate> > > END<br/> > > </body> > > </html:html> > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > > > TestForm.java: > > > > vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv > > package com.somewhere; > > > > import javax.servlet.http.HttpServletRequest; > > import org.apache.struts.action.*; > > import java.util.*; > > > > public final class TestForm extends ActionForm { > > > > private Collection myCollection; > > > > { > > myCollection = new Vector(); > > myCollection.add(new TestData("1")); > > myCollection.add(new TestData("two")); > > myCollection.add(new TestData("III")); > > } > > > > public Collection getTestData() { > > return myCollection; > > } > > } > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > > > TestData.java: > > > > vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv > > package com.somewhere; > > > > public final class TestData { > > > > private String myData; > > > > public TestData(String value) { > > myData = value; > > } > > > > public String getData() { > > return myData; > > } > > } > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > > > struts-config.xml: > > > > vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv > > <struts-config> > > <form-beans type="org.apache.struts.action.ActionFormBean"> > > <form-bean name="testContainer" > > type="com.somewhere.TestForm" /> > > </form-beans> > > <action-mappings type="org.apache.struts.action.ActionMapping"> > > <action path="/do_test" forward="/test.jsp" > > name="testContainer" > > validate="false"/> > > </action-mappings> > > </struts-config> > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > > > However, when I try to run this, it fails: > > > > vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv > > org.apache.jasper.JasperException: No getter method for > > property data of bean > > element > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > > > It must be something with either "element" being the id of > > the iteration or > > the name of the write tag, but I can't see any other way that > > I'd tell it to > > access the correct data. > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

