提供一种方法 :
jsp中如:
<html:text property="data(name)" />
<html:text property="data(password)" />
actionform 中
public DataForm extends ActionForm {
Map data = new HashMap();
public void setData(Map data) {this.data = data; }
public Map getData() {return this.data; }
public Object getVal(String key) {
return data.get(key);
}
}
action中
public testAction extends Action {
public ActionForward execute(....) {
String name = (String)((DataForm)form).get("name");
String password = (String)((DataForm)form).get("password");
....
}
}