• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionForm not setting indexed properties

 
Brian R. Wainwright
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I can't seem to get this ActionForm to work and I know it is something completely ridiculous that I'm overlooking. I essentially need a second pair of eyes on it:

I have an iteration of objects for which I want to set a value:



Struts config for this looks like so:



And the relevant ActionForm code...



The setter for my indexed property is never getting called. I never see the debug statement in the setCurrentDataItem method nor do I ever see a similar statement in the MyObject class for the setCurrentValue method (below):



I'm doing this smae thing elsewhere and it works like a charm. I'm obviously overlooking something. Any help?

Thanks!

[ March 31, 2005: Message edited by: Brian R. Wainwright ]
[ March 31, 2005: Message edited by: Brian R. Wainwright ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've made the assumption that Struts fully complies with nested object behavior in iterations. This would work in the nested tag libraries but not with what you have here.

The basic (non-nested library) Struts tags ignore the fact that your "currentValue" came from any dataItem bean. I could go into lengths explaining this but I have a suggestion to try that may help you discover for yourself what is going wrong.

Try changing the name of your ActionForm's setCurrentDataItem method to setCurrentValue and leave everything else the same. You should see your debug statement.
 
Brian R. Wainwright
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Marc. It turned out that the problem was with one of the Tiles inserts rendering an html form nested within the form on my page. My input fields were rendered within this nested form, but my submit buttons were outside of it. So what was happening is that my form was being submitted, but not with any data. Once I resolved that issue the code I provided above worked as it should. So for anyone looking to do the same thing - you can use the code I provided above as an example. And let that be a lesson to all you kids out there - always VIEW SOURCE! ;-)

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic