You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by xu...@gic.com.sg on 2004/04/22 10:51:24 UTC

No getter method for property p of bean b - getP is public in b's super class

I have a bean class B, whose super class is A.
dealNumber is defined as private String in A, and it has the following
getter/setter
  public String getDealNumber() {
      return dealNumber;
  }

  public void setDealNumber(String dealNumber) {
      this.dealNumber = dealNumber;
  }

Can this property be seen in <bean:write> if I use it to write properties
of an object b of class B?

In my JSP I set an instance of b to page context:
pageContext.setAttribute("CURR_TXN", b);

Then I do:
<bean:write name="CURR_TXN" property="dealNumber" scope="page"/>

But I got this error: No getter method for property dealNumber of bean
CURR_TXN

I then tried to add this into B:
  public String getDealNumber() {
      return super.getDealNumber();
  }

And then the error is gone... can anyone help to explain why?

Thanks.

XU CHENG




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: No getter method for property p of bean b - getP is public in b's super class

Posted by Daniel Henrique Alves Lima <em...@yahoo.com.br>.
    Are you sure that you using the up-to-date version of your class ? 
Maybe a misspelled method name or attribute name ?

    Try to make this test (in your .jsp):

<%
B b = new B();
%>

getDealNumber <%=b.getDealNumber%><br>
<%
pageContext.setAttribute("currTxn",b, PageContext.REQUEST_SCOPE);
%>

getDealNumber <bean:write name="currTxn" property="dealNumber"/>


xucheng@gic.com.sg wrote:

>I have a bean class B, whose super class is A.
>dealNumber is defined as private String in A, and it has the following
>getter/setter
>  public String getDealNumber() {
>      return dealNumber;
>  }
>
>  public void setDealNumber(String dealNumber) {
>      this.dealNumber = dealNumber;
>  }
>
>Can this property be seen in <bean:write> if I use it to write properties
>of an object b of class B?
>
>In my JSP I set an instance of b to page context:
>pageContext.setAttribute("CURR_TXN", b);
>
>Then I do:
><bean:write name="CURR_TXN" property="dealNumber" scope="page"/>
>
>But I got this error: No getter method for property dealNumber of bean
>CURR_TXN
>
>I then tried to add this into B:
>  public String getDealNumber() {
>      return super.getDealNumber();
>  }
>
>And then the error is gone... can anyone help to explain why?
>
>Thanks.
>
>XU CHENG
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: No getter method for property p of bean b - getP is public in b's super class

Posted by JavaSoft <ja...@yahoo.com>.
private attribute doesnt inherit to any child. Use
protected or higher level.

--- xucheng@gic.com.sg wrote:
> I have a bean class B, whose super class is A.
> dealNumber is defined as private String in A, and it
> has the following
> getter/setter
>   public String getDealNumber() {
>       return dealNumber;
>   }
> 
>   public void setDealNumber(String dealNumber) {
>       this.dealNumber = dealNumber;
>   }
> 
> Can this property be seen in <bean:write> if I use
> it to write properties
> of an object b of class B?
> 
> In my JSP I set an instance of b to page context:
> pageContext.setAttribute("CURR_TXN", b);
> 
> Then I do:
> <bean:write name="CURR_TXN" property="dealNumber"
> scope="page"/>
> 
> But I got this error: No getter method for property
> dealNumber of bean
> CURR_TXN
> 
> I then tried to add this into B:
>   public String getDealNumber() {
>       return super.getDealNumber();
>   }
> 
> And then the error is gone... can anyone help to
> explain why?
> 
> Thanks.
> 
> XU CHENG
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 


=====
==
thx,
a Java Student


	
		
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�
http://photos.yahoo.com/ph/print_splash

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org