将Action对应的ActionForm的userName属性赋值

解决方案 »

  1.   

    在action中用request.setAttribute("key",object);
    在页面中<input type="text" name="name" value="<bean:write name="key" property="userName" />">
      

  2.   

    不想用value这样附值,还有什么更好的方法吗? flyxxxxx(灭神) ,你的方法是?最好是能直接在Action里面更改userName的属性并附值~
      

  3.   

    ActionForm里面定义页面相同变量名, 在ActionForm中赋值,jsp中使用标签<bean:write name = "(你的ActionForm名称)" property = "(你的变量名)"/>就可以了
      

  4.   

    flyxxxxx(灭神)说的对
    我再具体说一下
    你的action可以这样写(其中的一部分哦)
    UserForm userForm = new UserForm();
    userForm.setUserName("weki");
    request.setAttribute("userForm",userForm);
    action完毕
    在jsp中
    <logic:iterate id="q" name="userForm" >   
         <bean:write name="q" property="userName"/>
    </logic:iterate>
    或者直接
    <bean:write name="userForm" property="userName"/>
    这只是个思路。具体的我有点忘记了
    也可能你直接拿过去不会成功
    稍作调试问题不大。
      

  5.   

    <logic:iterate> 这个循环标签,写这个做什么?
      

  6.   

    to: paopao270(泡泡(java追求者j2ee)) 
    我是想实现编辑时显示值在input里面操作一个 <bean:write name="q" property="userName"/> 显然是错误的。
      

  7.   

    你需要在ActionForm中这样处理:
      private String clname;//值对象中的一个属性
      private AirLine airLine;//VO值对象
      public String getClname() {
        return this.airLine.getClname();
      }
      public void setClname(String clname) {
        this.airLine.setClname(clname);
      }
      public String getCsname() {
        return this.airLine.getCsname();
      }
    public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
          HttpSession session = httpServletRequest.getSession();
          this.airLine = (AirLine)session.getAttribute("airLine");
      }在页面中直接写成<html:text property="userName">就可得到值