struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Harrison <paul-harri...@ntlworld.com>
Subject Re: Problems with an inherited getter in a derived bean
Date Wed, 18 Jun 2003 23:49:42 GMT
thanks for confirming that this should work - one fact that I omitted in 
my original mailing was that the classes were inner classes

i.e. it  was the PostCode.Area class that is in the collection

public class PostCode
{
     protected static class Pbase
    {
        protected String name;

        public String getName()
        {
            return name;
        }

    }
    public static class Area extends Pbase
    {
    }        
}

I works it I change the access on the Pbase class to public, but do I 
have to ? I thought that it was legal to have derived classes increase 
the accessibility - I do not want to expose the Pbase class.... - 
however this is pushing the limits of my knowledge about what should be 
happening.....


Alen Ribic wrote:

>I'm doing the same thing in my current project successfully.
>No problems in my specializes class.
>
>e.g.
>
>public abstract class BaseBusinessBean
>    implements java.io.Serializable {
>    protected int id;
>    protected String description;
>
>    // getters/setters here
>}
>
>e.g.
>
>public class Category
>    extends BaseBusinessBean {
>    // Category specific getters/setters
>}
>
>
>Now  I use Category class with no problem in my options for select box.
>
>You have code <snippet>?
>
>--Alen
>
>
>
>----- Original Message -----
>From: "Paul Harrison" <paul-harrison@ntlworld.com>
>To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
>Sent: Wednesday, June 18, 2003 4:55 PM
>Subject: Problems with an inherited getter in a derived bean
>
>
>  
>
>>In my struts application, I have a base bean with a set of basic
>>properties (e.g. name) and then I create various derived beans with
>>their own extra properties. I have a problem with the <html:options> tag
>>in that if I try to read a property  that is inherited from the base
>>bean  from a collection of the derived beans
>>
>>i.e. I have a tag like this
>>
>><html:options collection="CountyList" property="name" />
>>
>> - I get an error saying
>>
>>No getter method available for property name for bean under name
>>    
>>
>CountyList
>  
>
>> and if I implement the getter in the derived bean the  error goes away.
>>Is this known behaviour in struts - is seems like a bug to me (or
>>perhaps a bug in commons-beanutils?) Can anyone comment....
>>
>>--
>>Paul Harrison
>>
>>paul-harrison@ntlworld.com
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>  
>

-- 
Paul Harrison

paul-harrison@ntlworld.com
tel: 0161 428 2794
mob: 07904025192



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


Mime
View raw message