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 ;
   }
 }  

Reply via email to