• 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

ActionForm not setting indexed properties

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
reply
    Bookmark Topic Watch Topic
  • New Topic