javax.servlet.jsp.JspException: No getter method for property

27,740

It seems your getter and setter for ressellerId field are not properly named in GetAvailableAddressRequest class. You are using ID at the end of the method name instead of Id Corrected signatures below:

   public String getResellerId(){
        return this.resellerId;
    }
    public void setResellerId(String resellerId){
        this.resellerId = resellerId;
    }
Share:
27,740
Srihari
Author by

Srihari

I work with Html, CSS, JS, jQuery JAVA, PHP and Ruby On Rails. Wordpress, Joomla and Magento are my favorites now.

Updated on September 03, 2020

Comments

  • Srihari
    Srihari over 3 years

    I am unable to find out what I am doing wrong. I am bound to use Form Bean within Form Bean as there are numerous different parts of the form. Basically, there is a response part as well as request part on the same form.

    While initializing the view, I am getting a no getter method exception. I am using Struts 1.2

    javax.servlet.jsp.JspException: No getter method for property getAvailableAddres
    sRequest.resellerId of bean org.apache.struts.taglib.html.BEAN
        at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:968)
    

    struts-config.xml:

    <form-beans>
            <form-bean name="getAvailableAddress" type="com.wisor.talktalk.model.GetAvailableAddress" />
            <form-bean name="provideRequest" type="com.wisor.talktalk.common.talktalkbean.RequestActionForm" />
        </form-beans>
    
        <action-mappings>
            <action path="/ttTestJsp" type="com.wisor.talktalk.controller.TestJsp" 
                name="getAvailableAddress" 
                scope="session" 
                validate="false" 
                unknown="false">
                <forward name="init" path="/WEB-INF/talk/preorderView/getAvailableAddress.jsp"/>
            </action>
        </action-mappings>
    

    JSP Page:

    <html:form action="/ttTestJsp.do?task=getResponse" styleClass="form">
            <fieldset>
                <label class="inline label" for="reseller_id"><fmt:message
                        key="label.field.resellerId" />:</label>
                <html:text
                    property="getAvailableAddressRequest.resellerId"
                    styleClass="mandatory" readonly="readonly"></html:text>
            </fieldset>
        <html:submit value="GetAddress"/>
        </html:form>
    

    FormBean Main:

    public class GetAvailableAddress extends ActionForm{
        private GetAvailableAddressRequest getAvailableAddressRequest;
    
        public void intilize(){
            getAvailableAddressRequest = new GetAvailableAddressRequest();
        }
    
        public GetAvailableAddressRequest getGetAvailableAddressRequest(){
            return this.getAvailableAddressRequest;
        }
    
        public void setGetAvailableAddressRequest(GetAvailableAddressRequest getAvailableAddressRequest){
            this.getAvailableAddressRequest = getAvailableAddressRequest;
        }
    }
    

    child Form Bean:

    public class GetAvailableAddressRequest implements Serializable{
    
        private String resellerId;
    
        public String getResellerID(){
            return this.resellerId;
        }
        public void setResellerID(String resellerId){
            this.resellerId = resellerId;
        }
    }
    

    Action Class:

    public class TestJsp extends Action {
    Logger logger = Logger.getLogger(this.getClass());
    @Override
    public ActionForward execute( ActionMapping map, ActionForm actionForm,
            HttpServletRequest request, HttpServletResponse response) throws Exception{
    ActionForward forward = null;
            GetAvailableAddress form = (GetAvailableAddress) actionForm;
    form.intilize();
    forward = map.findForward("init");
            return forward;
    }}