我用的是Strust中的表单<form ...>
<html:text property="pubRegerTime" value="hello" />
</form>
我要实现的是在打开页面时,text显示的是hello,但我要去掉hello输入change,
也就是修改value的值,在Action中获取表单数据时要做到获取的是change而不是hello
请问各位高手这个功能怎么实现,是不是用JS,请给出具体的代码和详细说明,谢谢!~
<html:text property="pubRegerTime" value="hello" />
</form>
我要实现的是在打开页面时,text显示的是hello,但我要去掉hello输入change,
也就是修改value的值,在Action中获取表单数据时要做到获取的是change而不是hello
请问各位高手这个功能怎么实现,是不是用JS,请给出具体的代码和详细说明,谢谢!~
如果没什么特殊的需求了的话
楼上正解。。
你在提交表单后 你修改过的change就会传到ActionForm里
注意ActionForm里要填入pubRegerTime的信息 然后Action直接调用ActionForm就OK了
public class TimeForm extends ActionForm {
private int pubRegerTime; public int getpubRegerTime() {
return pubRegerTime;
} public void setpubRegerTime(int pubRegerTime) {
this.pubRegerTime = pubRegerTime;
}
public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
}
public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
pubRegerTime=null;
}
}