• 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

nested indexed properties in struts

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I'm having trouble with indexed properties. I have read the FAQ but my code has another level of nesting, which kind of messes things a bit.

The form contains an object of type Bill which contains a List of BillPart objects (with corresponding getters and setters). The user can enter a variable number of BillParts.

so the ActionForm has a



and my Bill class has the definition of the list of parts, and the method as suggested in the FAQ:



a BillPart has a name and an amount property.

In my jsp I put:


This doesn't create the appropriate name of the <input type="text"> property though. The setter of amount or name is never called.
I have tried several variations of what the <nested:text> name should be - nothing works. Other bill properties are set, but this nested ones aren't.
The generated html source doesn't look right:


It should be something like name="bill.part[0].name" or "bill.parts[0].name"


By omitting the name completely, I get a source html like this:


this should work - the hierarchy looks correct (not sure about the form[0] thing, but I assume it's something standard)

But still, the setters are never called. The other setters of Bill object are called, but never the ones of BillPart object.


Any suggestions?

Thank you
 
reply
    Bookmark Topic Watch Topic
  • New Topic