Rob, I find it useful (and easier) to work off of other's examples. Here's what I have done in the past (actually last Friday): <logic:iterate id="myList" name="countrystatcollection"> <tr> <td class=text7><bean:write name="myList" property="countryname"/></td> <td class=text7><bean:write name="myList" property="countryprocessedcount"/></td> <td class=text7><bean:write name="myList" property="countrytotalcount"/></td> </tr> </logic:iterate>
Where: 1) myList: is just an ID that I made up 2) countrystatcollection: is a collection ( java.util.List ) that I set on the request object in an action, which forwards to the page that contains the iterate tag. //get an object array from helper class CountryStat[] countryStatArray = ch.retrieveCountryCounts(); int iLength = countryStatArray.length; for(int n = 0; n < iLength; n++ ){ //don't add nulls if (countryStatArray[n] != null) list.add(countryStatArray[n]); } request.setAttribute("countrystatcollection", list); 3) countrystat: is a simple bean that contains the following members: protected String countryname = null; public String getCountryname() { return countryname; } public void setCountryname(String countryname) { this.countryname = countryname; } protected String countryprocessedcount = null; public String getCountryprocessedcount() { return countryprocessedcount; } public void setCountryprocessedcount(String asCountryprocessedcount) { this.countryprocessedcount = asCountryprocessedcount; } protected String countrytotalcount = null; public String getCountrytotalcount() { return countrytotalcount; } public void setCountrytotalcount(String asCountrytotalcount) { this.countrytotalcount = asCountrytotalcount; } Hope this provides some insight into your problem. Brian --- Rob Breeds <[EMAIL PROTECTED]> wrote: > > Brian > > Thanks so much for that pointer - that was the solution to that part of the > problem. > > Now I need to work out why the name value I'm submitting isn't getting into > the form... (just get nulls every time) > > Rob Breeds > > > > > > > Brian Dainton > > > <daintons@yaho To: Struts Users Mailing List > <[EMAIL PROTECTED]> > o.com> cc: > > > Subject: RE: how to dynamically add to > form > 13/11/2001 > > > 14:10 > > > Please respond > > > to "Struts > > > Users Mailing > > > List" > > > > > > > > > > > > > Rob, > > I ran into the same thing last week. Make sure your collection doesn't > contain any > 'nulls' (i.e. check for null before adding an item to the collection) > > Brian > --- Rob Breeds <[EMAIL PROTECTED]> wrote: > > Thanks Tom, that's certainly interesting stuff and it may solve my > problem > > (and for that I am truly grateful!). > > > > Is nesting of tags my problem? I still don't see why testcase fails: > > > > > This fails, with JSP error 'Cannot find bean el in scope null ' > > > <logic:iterate id="el" name="saveEntityForm" property="names"> > > > <bean:write name="el" property="name"/> > > > </logic:iterate> > > > > Thanks > > > > Rob Breeds > > > > > > > > > > > > > > "Tom Klaasen > > > > (TeleRelay)" To: "Struts Users Mailing > List" > > <[EMAIL PROTECTED]> > > <tom.klaasen@tele cc: > > > > relay.com> Subject: RE: how to > dynamically add to > > form > > > > > > 13/11/2001 13:23 > > > > Please respond to > > > > "Struts Users > > > > Mailing List" > > > > > > > > > > > > > > > > > > > > You should have a look at the nested: taglib from Arron Bates, that > > makes both these things really easy. > > > > Quoting his contribution mail: > > ----- > > For a built version and the updated example (I didn't want to send more > > than was necessary to provide the source)... > > http://www.keyboardmonkey.com/StrutMonkey/downloads/index.html > > > > Updated Running example... > > http://www.keyboardmonkey.com/StrutMonkey/ > > ----- > > > > > > hth, > > tomK > > > > > > > -----Original Message----- > > > From: Rob Breeds [mailto:[EMAIL PROTECTED]] > > > Sent: dinsdag 13 november 2001 13:57 > > > To: Struts Users Mailing List > > > Subject: how to dynamically add to form > > > Importance: High > > > > > > > > > > > > Hi > > > > > > I have an input JSP with a single form on it. The action for > > > the submit > > > will invoke the backend business logic and return a results page. Easy > > > enough. > > > > > > There are several distinct sections in the input page, one > > > for entering 1 > > > or more names, another for 1 or more descriptions, and other similar > > > sections requiring multiple inputs. > > > > > > Considering just the Names section, what I want to do is > > > allow the user to > > > enter a new name into a text input box and when they click an > > > 'Add' link > > > next to the name, it adds the name to the current list of names in the > > > ActionForm (stored in a Vector) and redisplays the input form > > > JSP showing > > > the current list of names plus a new input text box. The user > > > should be > > > able to add one name at a time ad infinitum until they finally hit the > > > submit button for the overall form. > > > > > > name1 <----------------------- > > > first 3 names > > > already entered > > > name2 <----------------------- > > > name3 <----------------------- > > > [ text box ] add name <---------------------- link to add > > > another name > > > and update display > > > > > > 1. How do I get the 'Add' link to pass the value of the input > > > text box into > > > the ActionForm? I have a field in the ActionForm called > > > newName, and when > > > the setNewName method is called it will add the new name to the Vector > > > called names. I can't see how to get to the form from a <html:link > > > forward>... and I shouldn't have to submit the form to update > > > each section > > > of the form should I? > > > > > > 2. For testing, I am submitting the form, and in the Action > > > adding dummy > > > data into the Vector of names (in NameBean objects with a > > > property of name) > > > and forwarding back to the input page. I use the <bean:iterate> tag to > > > display the contents of the Vector names, but it gives weird results:! > > > > > > Following works and displays the object references to the items in the > > > Vector so I know that there are the correct number of items: > > > <bean:write name="saveEntityForm" property="names"/> > > > > > > This fails, with JSP error 'Cannot find bean el in scope null ' > > > <logic:iterate id="el" name="saveEntityForm" property="names"> > > > <bean:write name="el" property="name"/> > > > </logic:iterate> > > > > > > It's almost as if the ActionForm isn't being saved in the > > > request but then > > > why does the display work when I don't use iterate? > > > > > > I'm going round in circles with this so any help to get me > > > moving again is > > > appreciated. > > > > > > Thanks > > > > > > Rob Breeds > > > > > > > > > > > > > > > > > > -- > > To unsubscribe, e-mail: < > mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: < > mailto:[EMAIL PROTECTED]> > > > > > __________________________________________________ > Do You Yahoo!? > Find the one for you at Yahoo! Personals > http://personals.yahoo.com > > -- > To unsubscribe, e-mail: < > mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: < > mailto:[EMAIL PROTECTED]> > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>