Struts uses reflection.  So if the method is there, it
will find it.  You will need a setter though for the
key method or it will generate errors.

Here is an excerpt from the PropertyUtils
documentation.

Utility methods for using Java Reflection APIs to
facilitate generic property getter and setter
operations on Java objects. Much of this code was
originally included in BeanUtils, but has been
separated because of the volume of code involved. 

In general, the objects that are examined and modified
using these methods are expected to conform to the
property getter and setter method naming conventions
described in the JavaBeans Specification (Version
1.0.1). No data type conversions are performed, and
there are no usage of any PropertyEditor classes that
have been registered, although a convenient way to
access the registered classes themselves is included. 

David
--- "Nanduri, Amarnath"
<[EMAIL PROTECTED]> wrote:
> Hi my fellow Strutters,
> 
> 
>     got an interesting question for you all to
> ponder. I am using the tag
> 
> <bean:write name="ABCForm"
> property="superclassObject.key" /> in my jsp
> pages.  
> 
> 
> WILL THIS WORK ? Is struts smart enough to know that
> i am returning a
> subclass and so can call its private variable using
> the getter method ? I
> know that introspection is being performed inside.
> Some expert advise is
> helpful...
> 
> I am enclosing the code for this..
> 
> public class ABCForm extends ActionForm
> {
> 
>   public  SuperClass  getSuperClassObject()
>   {
>     // basically it returns a Subclass upcasted to
> the superclass.    
>     return  superclassObject ;
>   }
> 
> 
> }
> 
> 
>  public  SuperClass
>  {
>    
>  }
> 
> 
>  public  SubClass extends  SuperClass
>  {
>    private String key ;
> 
>    public  String getKey()
>    {
>      return key ;
>    }
>  }  


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Reply via email to