用Struts的标签编写jsp页面,输入框的名字和ActionForm中的变量名一致
Struts会自动把变量的值插入到输入框中

解决方案 »

  1.   

    有没有示例呢,谢谢你,我才接触struts
      

  2.   

    <bean:write name="actionForm的名字" property="属性名">
      

  3.   

    jsp页面:
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html>
    <head><title></title></head>
    <body>
    <html:form action="/....do">
    <html:text property="name"/>
    <html:submit>
    </html:form>
    </html:html>ActionForm中:
    private String name;
    public void setName(String name){
    this.name=name;
    }public String getName(){
    return this.name;
    }Action中:
    ActionForm.setName(...);
      

  4.   

    To dxj1234(Kindly⊙Wolf)  谢谢您
     我在jsp页面上是这样来写的 <html:text property="code"/>
     这是一个文本框,可是我如果让actionForm的值现示在这个文本框里面呢
     谢谢你
      

  5.   

    我是共用了一个actionForm在config_struts中是这样写的 <action 
              attribute="actionForm"
              input="/aaa/update.jsp"
              name="names"
              path="/path"
              scope="request" 
              type="***.***.***Action"/>
      

  6.   

    <html:text name="names" property="code"/>
      

  7.   

    谢谢 bluesmile979(笑着)   我已经按照你说的改过来,在actionForm里面加入了测试代码,发现在页面初试化的时候,会调用这个actionForm里的getter方法了,在actionForm里加入了输出语句子,输出的值是个null,
    可是,我在action里面明明sett了这个值的呀!!(我的这个actionForm在查询,增加时也用到了,但似乎关系不是很大)