Help, Don't konw what I am doing wrong

Discussions

Web tier: servlets, JSP, Web frameworks: Help, Don't konw what I am doing wrong

  1. Help, Don't konw what I am doing wrong (2 messages)

    Hi Everyone,

    I am trying to create a registration page using struts framework. but have not successeded so far, I am getting an error saying:
    org.apache.jasper.JasperException:
    No getter method for property CustName of bean org.apache.struts.taglib.html.BEAN

    my register.jsp starts with something like

    <html:form action="/register" type="app.RegisterAction" name="registerForm">
    <table width = "500" border = "0">
     <tr>
      <th align="right">Username:</th>
      <td align="left"><html:textproperty="CustName" /></TD>
      <th align="right">Address:</th>
      <td align="left"><html:text property="Address" /></TD>

    where my struts-config.xml has

    <struts-config>
      <form-beans>
        <form-bean name="registerForm" type="app.RegisterForm"/>
      </form-beans>
      <action-mappings>
        <action path="/register"
                   type="app.RegisterAction"
                   name="registerForm">
          <forward name="success" path="/success.html"/>
          <forward name="failure" path="/failure.html"/>
        </action>
      </action-mappings>
    </struts-config>

    and my app.RegisterForm starts has
      public String getCustName() {
            return this.CustName;
        }
        
        public String getAddress() {
            return this.Address;
        }
     public void setCustName(String CustName) {
            this.CustName = CustName;
        }
        
        public void setAddress(String Address) {
            this.Address = Address;
        }

    Thank you in advance
  2. Just an idea, try changing the "CustName" to "custName" in your JSP. In other words, change this:

    <html:textproperty="CustName"/>

    to

    <html:textproperty="custName"/>

    Notice the lowercase "c".

    Also, although you didn't show it in your post, I assume that you have the instance variable "custName declared in your RegistrationForm somewhere like:

    private String CustName = null;

    Make sure to change (if not already done so) to

    private String custName = null;

    Chuck
  3. Thank you Chuck for your quick reply.

    I will change the properties to lower cases in the jsp and in the ActionForm. hopefully that solves the problem. thanks Again
    A