action 中读取传值问题
链接如下:
http://127.0.0.1:8080/menuedit.do?url=edit&id=10
baseForm类如下
public class BaseForm extends DynaValidatorForm {
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
struts-config.xml
配置如下:
<form-bean name= "menuForm " type= "com.form.BaseForm ">
<form-property name= "datetime " type= "java.lang.String " initial= "2007-01-01 "/>
<form-property name= "url " type= "java.lang.String " />
</form-bean>
Action如下
DynaValidatorForm menuForm = (DynaValidatorForm) form;
(BaseForm) menuForm.getId();
menuForm.get( "url ")
问怎么在action为什么不能读取id这个值
注:url可以读取,id读取时为0.页面无错误
------解决方案-------------------- <form-bean name= "menuForm " type= "com.form.BaseForm ">
<form-property name= "datetime " type= "java.lang.String " initial= "2007-01-01 "/>
<form-property name= "url " type= "java.lang.String " />
</form-bean>
你的From中没有配置id这个property
------解决方案--------------------关注中
------解决方案--------------------直接不是在form中有getter和setter的函数么,action调用即可