This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes struts 1.2 dynaform not populating object contained in map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts 1.2 dynaform not populating object contained in map" Watch "struts 1.2 dynaform not populating object contained in map" New topic

struts 1.2 dynaform not populating object contained in map

fred ebrard

Joined: Dec 19, 2010
Posts: 1

I have a page with a dynaValidatorform which contains a hashmap. This hashmap contains an object which properties are not set when submitting the form.
I am missing one point here.
It shows ok on the page. there is no way it would populate these objects' properties criteriaOperator and criteriaString with the values inserted in the page.

here is the code of the jsp
<c:forEach var="criteriaMap" items="${}" varStatus="status">
<tr >
<td width="5%"><html-el:checkbox property="selectedCBCriteria(${criteriaMap.key})"/>
<td width="12%">Critère
<cut value="${status.index}"/></td>
<td width="16%">
<html-el:select name="criteriaMap" property="value.criteriaOperator" >
<html-elption value="100" >contient </html-elption>
<html-elption value="101" >ne contient </html-elption>
<td width="69%"><html:text name="criteriaMap" property="value.criteriaString" size="50" /></td>

the definition of the dynaForm
<form-bean name="dynamicBusinessFilterForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="subcategory1" type="java.lang.String" initial="0"/>
<form-property name="subcategory2" type="java.lang.String" initial="0"/>
<form-property name="adProvider" type="java.lang.String[]"/>
<form-property name="selectedCBProvider" type="java.util.HashMap"/>
<form-property name="dispatch" type="java.lang.String"/>
<form-property name="globalOperator" type="java.lang.String" initial="1"/>
<form-property name="selectedCBCriteria" type="java.util.HashMap"/>
<form-property name="criteriaMap" type="java.util.LinkedHashMap"/>
<form-property name="businessFilterName" type="java.lang.String"/>

one action that displays the values

Map criteriaMap= (LinkedHashMap)df.get("criteriaMap");
String fistTextValue = ((CriteriaBean)criteriaMap.get("0")).getCriteriaOperator();

and the CriteriaBean
public class CriteriaBean {

String criteriaString, criteriaOperator;

public String getCriteriaOperator() {
return criteriaOperator;

public void setCriteriaOperator(String criteriaOperator) {
this.criteriaOperator = criteriaOperator;

public CriteriaBean(){

public String getCriteriaString() {
return criteriaString;
public void setCriteriaString(String criteriaString) {
this.criteriaString = criteriaString;


any help would be appreciated


I agree. Here's the link:
subject: struts 1.2 dynaform not populating object contained in map