• Post Reply Bookmark Topic Watch Topic
  • New Topic

nested indexed properties in struts

Dianne Pop
Posts: 8
  • Mark post as helpful
  • send pies
  • 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
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!