This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes html:checkbox element with POJO-based array not updated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:checkbox element with POJO-based array not updated" Watch "html:checkbox element with POJO-based array not updated" New topic
Author

html:checkbox element with POJO-based array not updated

Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
I am defining a Struts FormBean with an array of POJO objects and populating the array in an Action that presents the page with the form. When I change the values in the JSP page and submit the form, then values of the POJO are not changed, i.e. they still
hold the original values from the initial population activity instead of taking on the new values.

It seems like the Struts Framework is not calling the set methods on the POJOs. Other fields in the FormBean are indeed being updated. Below are snippets of the configuration file and the JSP page. Am I missing some step to get this to work? This is using Struts version 1.3.


In struts-config.xml file:



In JSP file:

Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
I was using the wrong type of HTML control, e.g. checkbox. And the POJO field was switched from boolean to String.

Also, needed modify iterate start-tag. See below:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:checkbox element with POJO-based array not updated
 
Similar Threads
Problem Passing Parameter values to action
Cant Access contents of form in forms Action class...
Checking Checkbox values in indexed form
how to populate formbean property using html:checkbox values
can't get indexed form property to work.