permaculture playing cards*
The moose likes Struts and the fly likes ActionForm not setting indexed properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionForm not setting indexed properties" Watch "ActionForm not setting indexed properties" New topic
Author

ActionForm not setting indexed properties

Brian R. Wainwright
Ranch Hand

Joined: Aug 12, 2003
Posts: 92
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

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
Brian R. Wainwright
Ranch Hand

Joined: Aug 12, 2003
Posts: 92
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ActionForm not setting indexed properties
 
Similar Threads
List Objects in Form Bean has null values...mostly
Problem Passing Parameter values to action
Indexed tags and form beans
Radio Button values
Javascript and Struts Indexed Text Boxes