GeeCON Prague 2014*
The moose likes Struts and the fly likes nested indexed properties in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "nested indexed properties in struts" Watch "nested indexed properties in struts" New topic
Author

nested indexed properties in struts

Dianne Pop
Greenhorn

Joined: May 07, 2003
Posts: 8
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
 
GeeCON Prague 2014
 
subject: nested indexed properties in struts