wood burning stoves*
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
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
Author

struts 1.2 dynaform not populating object contained in map

fred ebrard
Greenhorn

Joined: Dec 19, 2010
Posts: 1
Hi,

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="${dynamicBusinessFilterForm.map.criteriaMap}" varStatus="status">
<tr >
<td width="5%"><html-el:checkbox property="selectedCBCriteria(${criteriaMap.key})"/>
</td>
<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>
</html-el:select>
</td>
<td width="69%"><html:text name="criteriaMap" property="value.criteriaString" size="50" /></td>
</tr>
</c:forEach>


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"/>
</form-bean>

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(){
this.criteriaOperator=IFilter.DOES_CONTAIN_OPERATOR.toString();
}

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


}


any help would be appreciated

thanks

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts 1.2 dynaform not populating object contained in map