• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

forms and collections

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone.
I'm having a problem with trying to get my html:form to populate the collection in my actionform. Here is the code snippet:
<html:form action="/deleteAddress">
<html:hidden name="groupForm" property="groupID"/>
<logic:iterate name="addresses" id="address">
<tr>
<td><bean:write name="address" property="phoneNumber"/> </td>
<td><bean:write name="address" property="name"/></td>
<td>
<html:checkbox name="address" property="delete"/></tr>
<html:hidden name="address" property="addressID"/>
</logic:iterate>
...etcetera
The deal is that the form is being populated happily by large the address collection from my form bean (groupForm). But when I submit it, the collection is not being populated. The other fields in the form form are being populated as you might expect (eg the groupID is being populated), but the collection remains empty. How do I persuade struts to put the iterated items back into the collection? Is there some other way to do this sort of thing?
The basic aim is to get something like the inbox in hotmail, where you can select emails for deletion.
Any suggestions would help, I'm really tearing my hair out here.

Alister
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use indexed property syntax. See http://www.developer.com/java/ejb/article.php/2233591 for examples
 
Alister Pate
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for that.
It strikes me that there's a certain irony in an article on how to write struts based applications being served by php rather than java....
Alister
 
Alister Pate
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, I was kinda hoping to find some way of doing it with collections rather than arrays...
Still, I'll give this a bash.
Alister
 
Alister Pate
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, I found a really good link (After several hours of trying) which explained it very well. Here 'tis
"http://www.mail-archive.com/struts-user@jakarta.apache.org/msg74986.html
And if you find, like I did, that you get errors saying something like "indexed not allowed by TLD", then you might want to consider updating your copy of struts (the tlds and the jar file) - it took me a little while to work that out.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic