一般是因为ActionForm中的property和jsp中定义的名字不对应造成的,只要检查一下,将其统一。

解决方案 »

  1.   

    我是用jbuilder,先定义一个actionForm,然后从actionForm产生jsp,应该名字是一样的啊,而且从上面的代码看也应该是一样的啊
      

  2.   

    你的页面里面的form表单是不是匹配
      

  3.   

    这是我的jsp
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ page contentType="text/html; charset=gb2312" %>
    <html:html locale="true">
    <head>
    <title>
    authorinfo.jsp
    </title>
    <html:base/>
    </head>
    <body>
    <h1>JBuilder Generated Struts JSP for ActionForm com.jesus.transaction.info.AuthorInfoForm</h1>
    <p>
    <html:form action="/authorlogon.do" method="POST"><html:text property="firstEmail"/>
    <br>
    <html:text property="mailCode"/>
    <br>
    <html:text property="mobilePhone"/>
    <br><html:text property="secondEmail"/>
    <br>
    <html:text property="telePhone"/>
    <br>
    <html:text property="units"/>
    <br>
    <html:text property="userName"/><br>
      <html:text property="qq"/>
    <br>
      <html:text property="re"/>
    <br>
    <html:submit property="submit" value="Submit"/><br>
    <html:reset value ="Reset"/>
    </html:form>
    </body>
    </html:html>
      

  4.   

    package com.jesus.transaction.info;import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionMapping;
    import javax.servlet.http.HttpServletRequest;public class AuthorInfoForm extends ActionForm {
        private String firstEmail;
        private String mailCode;
        private String mobilePhone;
        private String qq;
        private String re;
        private String secondEmail;
        private String telePhone;
        private String units;
        private String userName;
        public String getFirstEmail() {
            return firstEmail;
        }    public void setFirstEmail(String firstEmail) {
            this.firstEmail = firstEmail;
        }    public void setUserName(String userName) {
            this.userName = userName;
        }    public void setUnits(String units) {
            this.units = units;
        }    public void setTelePhone(String telePhone) {
            this.telePhone = telePhone;
        }    public void setSecondEmail(String secondEmail) {
            this.secondEmail = secondEmail;
        }    public void setRe(String re) {
            this.re = re;
        }    public void setQq(String qq) {
            this.qq = qq;
        }    public void setMobilePhone(String mobilePhone) {
            this.mobilePhone = mobilePhone;
        }    public void setMailCode(String mailCode) {
            this.mailCode = mailCode;
        }    public String getMailCode() {
            return mailCode;
        }    public String getMobilePhone() {
            return mobilePhone;
        }    public String getQq() {
            return qq;
        }    public String getRe() {
            return re;
        }    public String getSecondEmail() {
            return secondEmail;
        }    public String getTelePhone() {
            return telePhone;
        }    public String getUnits() {
            return units;
        }    public String getUserName() {
            return userName;
        }    public ActionErrors validate(ActionMapping actionMapping,
                                     HttpServletRequest httpServletRequest) {
                /** @todo: finish this method, this is just the skeleton.*/
            return null;
        }    public void reset(ActionMapping actionMapping,
                          HttpServletRequest servletRequest) {
        }
    }
      

  5.   

    把这个firstEmail先注解了,包括form,jsp.别的mailCode,mobilePhone之类的能正常否?
      

  6.   

    看看struts-config.xml配置文件有没有配置对了
      

  7.   

    我试过遇到过这种问题,后来发现是以下两个原因造成的,楼主请检查一下。
    1
     如果把属性变量开头字母写成大写,例如String  MyName  ,那么String getMyName(){}就不会被认为是MyName的getter,但从你贴出来的代码,好像不是这个原因。2 我正在编辑的文件,没被编译并布署到服务器相应目录下,这通常是IDE的错误,如果用Myeclipse的自动deploy时,就出现过这种情况。试试手工编译一个java文件,把class手动复制到服务器中就知道了。
      

  8.   

    to SDMRauquin(冷月无心) 
    我把firstEmail注释了,可是下面的还是提示同样的问题to terry_yip
    我用的jb,又编译一次,看生成的class的时间应该没问题了,可是问题仍存在
      

  9.   

    还是提示No getter method for property firstEmail of bean ?或者是其他的mailCode,mobilePhone   No getter method 。如果这样的话 是不是你的配置没有对 struct 中指向的form没有配好。而不是form中的某个属性不对。
      

  10.   

    在jsp里除了把userName没问题,其他的都会提示no getter
      

  11.   

    非常感谢各位,确实是我的失误。
    SDMRauquin说的对,是我jsp里提交的path不对,