我用的是Strust中的表单<form ...>
 <html:text property="pubRegerTime" value="hello" />
</form>
我要实现的是在打开页面时,text显示的是hello,但我要去掉hello输入change,
也就是修改value的值,在Action中获取表单数据时要做到获取的是change而不是hello
请问各位高手这个功能怎么实现,是不是用JS,请给出具体的代码和详细说明,谢谢!~

解决方案 »

  1.   

    你text的值改变后提交表单后,另一边得到的就已经是改变后的值了,用不着JS
    如果没什么特殊的需求了的话
      

  2.   

    struts框架以及自动帮我们填充
    楼上正解。。
      

  3.   

    不用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;
      
       }
    }
      

  4.   

    然后你再认真检查一下你写的Action对表单的处理有没有问题