You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Mulligan <da...@LECAN.ie> on 2003/02/07 12:23:30 UTC
Mapped Properties
I am trying to use dynamically generated forms with Struts. Since the form
is dynamic I will not know the form fields until runtime.
After a lot of time searching throught the mailing list I found Mapped
Properties.
http://jakarta.apache.org/struts/faqs/indexedprops.html#mappedprops
But for some strange reason I can't get them to work
In my page I got
<input type="hidden" name="randomData" value="xxx">
<input type="hidden" name="dynaField(title1)" value="theValue1">
<input type="hidden" name="dynaField(title2)" value="theValue2">
and in the form
public class TheForm extends org.apache.struts.action.ActionForm {
private Map dynaField = new HashMap();
private String randomData;
public void reset(ActionMapping mapping, HttpServletRequest request) {
super.reset(mapping, request);
this.dynaField.clear();
this.randomData=null;
}
public void setDynaField(String key, Object value) {
dynaField.put(key, value);
}
public Object getDynaField(String key) {
return dynaField.get(key);
}
public Map getDynaField() {
return dynaField;
}
public String getRandomData() {
return randomData;
}
public void setRandomData(String randomData) {
this.randomData = randomData;
}
}
The strange part is the randomData gets loaded correctly and the dynaField
map doesn't!
Should my Form extends something other then ActionForm? Is there any working
examples?
I'm using Struts-1.1b3
Tnx.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org