You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Denis Wang <dw...@brandmuscle.com> on 2002/12/09 15:51:05 UTC

related code RE: does ActionForm support inheritance field

JSP:
<nested:form action='/myquestion'>
<nested:nest property='scheduleVO'>
<nested:text property='description' size="30"/>
...
ActionForm:
...
    private ScheduleVO scheduleVO;
    public ScheduleVO getScheduleVO() {
        return this.scheduleVO;
    }
    public void setScheduleVO(ScheduleVO scheduleVO) {
        this.scheduleVO = scheduleVO;
    }
...
ScheduleVO:
public class ScheduleVO extends ScheduleBean {
...
}
ScheduleBean, which is in the same package with ScheduleVO:
...
    String description;	// i tried both package level/private level access
modifier
    public String getDescription() {
        return this.description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
.....

-----Original Message-----
From: Denis Wang [mailto:dwang@brandmuscle.com]
Sent: Monday, December 09, 2002 9:28 AM
To: struts
Subject: does ActionForm support inheritance field


Hello,
Sorry to send the question again.  But I didn't see the message appearing on
the mailing list for some reasons.  Besides the previous message has a wrong
return email address.

I have an ActionForm, which includes a field/getter/setter of subclass.  The
subclass inherits the description field/getter/setter method from its
superclass.
In my JSP page, I try to access the description.  But it is complained "no
getter method for subclass.description in the ActionForm".
Does anybody have any clue?  Is it a limitation of Struts?
Thanks.
Denis



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: possible limited supports for inheritance in struts?

Posted by Denis Wang <dw...@brandmuscle.com>.
may i see you sample codes?
thanks.
denis

-----Original Message-----
From: Gemes Tibor [mailto:gemes@regens.hu]
Sent: Tuesday, December 10, 2002 10:37 AM
To: Struts Users Mailing List
Subject: Re: possible limited supports for inheritance in struts?


2002. december 10. 16:26 dátummal Denis Wang ezt írtad:
> I have an ActionForm, which includes a field/getter/setter of "subclass".
> The subclass inherits "superField" field/getter/setter from its
superclass.
> In my JSP page, I try to access the "superField".  But it is complained
"no
> getter method for subclass.superField in the ActionForm".  See p.s. for
> related codes.

I use inheritance frequently however not with nested taglib. So I suppose
the
problem is (if any) with the nested taglib.

Hth,

Tib

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: possible limited supports for inheritance in struts?

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 10. 16:26 dátummal Denis Wang ezt írtad:
> I have an ActionForm, which includes a field/getter/setter of "subclass".
> The subclass inherits "superField" field/getter/setter from its superclass.
> In my JSP page, I try to access the "superField".  But it is complained "no
> getter method for subclass.superField in the ActionForm".  See p.s. for
> related codes.

I use inheritance frequently however not with nested taglib. So I suppose the 
problem is (if any) with the nested taglib.

Hth,

Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: possible limited supports for inheritance in struts?

Posted by Vinh Tran <vi...@processintelligence.com>.
There is nothing magical about the JSP but below is an excerpt. Just so you
know I return the type of the base class and I access the fields in my
subclass just fine.

Iterate through a collection of myVO objects...

<bean:define id="mymap" name="myclass" property="myMap"/>
<logic:iterate id="vo" name="mymap" property="myVO">
	<bean:write name="vo" property="subclassField"/>
	<bean:write name="vo" property="baseclassField"/>
</logic:iterate>

-----Original Message-----
From: Denis Wang [mailto:dwang@brandmuscle.com]
Sent: Tuesday, December 10, 2002 12:01 PM
To: Struts Users Mailing List; vinht@processintelligence.com
Subject: RE: possible limited supports for inheritance in struts?


Thanks for your reply.  ActionForm needs access to
ScheduleVO.subclassFields, which are not present in ScheduleBean.
Would you please forward your jsp code, which does not use nested tage?
Thanks.
Denis

-----Original Message-----
From: Vinh Tran [mailto:vinht@processintelligence.com]
Sent: Tuesday, December 10, 2002 11:55 AM
To: Struts Users Mailing List
Subject: RE: possible limited supports for inheritance in struts?


One more thing...

Why is the ActionForm using type ScheduleVO instead of ScheduleBean? You may
want to try returning ScheduleBean.

Vinh

-----Original Message-----
From: Denis Wang [mailto:dwang@brandmuscle.com]
Sent: Tuesday, December 10, 2002 10:26 AM
To: Struts Users Mailing List
Cc: shirishchandra.sakhare@ubs.com
Subject: possible limited supports for inheritance in struts?


Hello, all,
Sorry for re-post.  I believer this is a problem worthywhile of attention.
I posted this message yesterday, but basically no answers.

I have an ActionForm, which includes a field/getter/setter of "subclass".
The subclass inherits "superField" field/getter/setter from its superclass.
In my JSP page, I try to access the "superField".  But it is complained "no
getter method for subclass.superField in the ActionForm".  See p.s. for
related codes.

Does anybody have any clue?  Is it a limitation of Struts, ActionForm or
only the nested tags?  Is it possibly caused by Real Time Type
Identification/Reflection?  Is it possibly caused by serializable?

Thanks.
Denis

p.s. related codes
1) JSP:
<nested:form action='/myquestion'>
<nested:nest property='scheduleVO'>
<nested:text property='description'/>
...
2) ActionForm:
...
    private ScheduleVO scheduleVO;  //The reference is in the type of
ScheduleVO instead of ScheduleBean
    public ScheduleVO getScheduleVO() {
        return this.scheduleVO;
    }
    public void setScheduleVO(ScheduleVO scheduleVO) {
        this.scheduleVO = scheduleVO;
    }
...
3) ScheduleVO:
public class ScheduleVO extends ScheduleBean {
...
}

4) ScheduleBean, which is in the same package with ScheduleVO:

class ScheduleBean implements Serializable {	//the class is in the scope of
package
...
    String description;	// i tried both package/private level access
modifiers
    public String getDescription() {
        return this.description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
.....
}

p.s.2
In order to narrow down the problem, I did some comparision experiments:
1) Replace "superField" with "subclassLocalField", which is a local filed in
the subclass.  Everything works fine.
2) Replace "superField" with "superField2".  Not working as expected.  Be
sure nothing related to typo.
3) Copy "superField" field/getter/setter from superclass into the subclass.
Everything works fine.



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: possible limited supports for inheritance in struts?

Posted by Denis Wang <dw...@brandmuscle.com>.
Thanks for your reply.  ActionForm needs access to
ScheduleVO.subclassFields, which are not present in ScheduleBean.
Would you please forward your jsp code, which does not use nested tage?
Thanks.
Denis

-----Original Message-----
From: Vinh Tran [mailto:vinht@processintelligence.com]
Sent: Tuesday, December 10, 2002 11:55 AM
To: Struts Users Mailing List
Subject: RE: possible limited supports for inheritance in struts?


One more thing...

Why is the ActionForm using type ScheduleVO instead of ScheduleBean? You may
want to try returning ScheduleBean.

Vinh

-----Original Message-----
From: Denis Wang [mailto:dwang@brandmuscle.com]
Sent: Tuesday, December 10, 2002 10:26 AM
To: Struts Users Mailing List
Cc: shirishchandra.sakhare@ubs.com
Subject: possible limited supports for inheritance in struts?


Hello, all,
Sorry for re-post.  I believer this is a problem worthywhile of attention.
I posted this message yesterday, but basically no answers.

I have an ActionForm, which includes a field/getter/setter of "subclass".
The subclass inherits "superField" field/getter/setter from its superclass.
In my JSP page, I try to access the "superField".  But it is complained "no
getter method for subclass.superField in the ActionForm".  See p.s. for
related codes.

Does anybody have any clue?  Is it a limitation of Struts, ActionForm or
only the nested tags?  Is it possibly caused by Real Time Type
Identification/Reflection?  Is it possibly caused by serializable?

Thanks.
Denis

p.s. related codes
1) JSP:
<nested:form action='/myquestion'>
<nested:nest property='scheduleVO'>
<nested:text property='description'/>
...
2) ActionForm:
...
    private ScheduleVO scheduleVO;  //The reference is in the type of
ScheduleVO instead of ScheduleBean
    public ScheduleVO getScheduleVO() {
        return this.scheduleVO;
    }
    public void setScheduleVO(ScheduleVO scheduleVO) {
        this.scheduleVO = scheduleVO;
    }
...
3) ScheduleVO:
public class ScheduleVO extends ScheduleBean {
...
}

4) ScheduleBean, which is in the same package with ScheduleVO:

class ScheduleBean implements Serializable {	//the class is in the scope of
package
...
    String description;	// i tried both package/private level access
modifiers
    public String getDescription() {
        return this.description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
.....
}

p.s.2
In order to narrow down the problem, I did some comparision experiments:
1) Replace "superField" with "subclassLocalField", which is a local filed in
the subclass.  Everything works fine.
2) Replace "superField" with "superField2".  Not working as expected.  Be
sure nothing related to typo.
3) Copy "superField" field/getter/setter from superclass into the subclass.
Everything works fine.



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: possible limited supports for inheritance in struts?

Posted by Vinh Tran <vi...@processintelligence.com>.
One more thing...

Why is the ActionForm using type ScheduleVO instead of ScheduleBean? You may
want to try returning ScheduleBean.

Vinh

-----Original Message-----
From: Denis Wang [mailto:dwang@brandmuscle.com]
Sent: Tuesday, December 10, 2002 10:26 AM
To: Struts Users Mailing List
Cc: shirishchandra.sakhare@ubs.com
Subject: possible limited supports for inheritance in struts?


Hello, all,
Sorry for re-post.  I believer this is a problem worthywhile of attention.
I posted this message yesterday, but basically no answers.

I have an ActionForm, which includes a field/getter/setter of "subclass".
The subclass inherits "superField" field/getter/setter from its superclass.
In my JSP page, I try to access the "superField".  But it is complained "no
getter method for subclass.superField in the ActionForm".  See p.s. for
related codes.

Does anybody have any clue?  Is it a limitation of Struts, ActionForm or
only the nested tags?  Is it possibly caused by Real Time Type
Identification/Reflection?  Is it possibly caused by serializable?

Thanks.
Denis

p.s. related codes
1) JSP:
<nested:form action='/myquestion'>
<nested:nest property='scheduleVO'>
<nested:text property='description'/>
...
2) ActionForm:
...
    private ScheduleVO scheduleVO;  //The reference is in the type of
ScheduleVO instead of ScheduleBean
    public ScheduleVO getScheduleVO() {
        return this.scheduleVO;
    }
    public void setScheduleVO(ScheduleVO scheduleVO) {
        this.scheduleVO = scheduleVO;
    }
...
3) ScheduleVO:
public class ScheduleVO extends ScheduleBean {
...
}

4) ScheduleBean, which is in the same package with ScheduleVO:

class ScheduleBean implements Serializable {	//the class is in the scope of
package
...
    String description;	// i tried both package/private level access
modifiers
    public String getDescription() {
        return this.description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
.....
}

p.s.2
In order to narrow down the problem, I did some comparision experiments:
1) Replace "superField" with "subclassLocalField", which is a local filed in
the subclass.  Everything works fine.
2) Replace "superField" with "superField2".  Not working as expected.  Be
sure nothing related to typo.
3) Copy "superField" field/getter/setter from superclass into the subclass.
Everything works fine.



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: possible limited supports for inheritance in struts?

Posted by Vinh Tran <vi...@processintelligence.com>.
Denis:

I too use inheritance just fine but I do not use nested tags.  Try
implementing Serializable in ScheduleVO as well.  Just a wild guess.  If
that doesn't work simply try to get a field from the superclass using
something other than the nested tags to see if the tags are a problem.

Vinh

-----Original Message-----
From: Denis Wang [mailto:dwang@brandmuscle.com]
Sent: Tuesday, December 10, 2002 10:26 AM
To: Struts Users Mailing List
Cc: shirishchandra.sakhare@ubs.com
Subject: possible limited supports for inheritance in struts?


Hello, all,
Sorry for re-post.  I believer this is a problem worthywhile of attention.
I posted this message yesterday, but basically no answers.

I have an ActionForm, which includes a field/getter/setter of "subclass".
The subclass inherits "superField" field/getter/setter from its superclass.
In my JSP page, I try to access the "superField".  But it is complained "no
getter method for subclass.superField in the ActionForm".  See p.s. for
related codes.

Does anybody have any clue?  Is it a limitation of Struts, ActionForm or
only the nested tags?  Is it possibly caused by Real Time Type
Identification/Reflection?  Is it possibly caused by serializable?

Thanks.
Denis

p.s. related codes
1) JSP:
<nested:form action='/myquestion'>
<nested:nest property='scheduleVO'>
<nested:text property='description'/>
...
2) ActionForm:
...
    private ScheduleVO scheduleVO;  //The reference is in the type of
ScheduleVO instead of ScheduleBean
    public ScheduleVO getScheduleVO() {
        return this.scheduleVO;
    }
    public void setScheduleVO(ScheduleVO scheduleVO) {
        this.scheduleVO = scheduleVO;
    }
...
3) ScheduleVO:
public class ScheduleVO extends ScheduleBean {
...
}

4) ScheduleBean, which is in the same package with ScheduleVO:

class ScheduleBean implements Serializable {	//the class is in the scope of
package
...
    String description;	// i tried both package/private level access
modifiers
    public String getDescription() {
        return this.description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
.....
}

p.s.2
In order to narrow down the problem, I did some comparision experiments:
1) Replace "superField" with "subclassLocalField", which is a local filed in
the subclass.  Everything works fine.
2) Replace "superField" with "superField2".  Not working as expected.  Be
sure nothing related to typo.
3) Copy "superField" field/getter/setter from superclass into the subclass.
Everything works fine.



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


possible limited supports for inheritance in struts?

Posted by Denis Wang <dw...@brandmuscle.com>.
Hello, all,
Sorry for re-post.  I believer this is a problem worthywhile of attention.
I posted this message yesterday, but basically no answers.

I have an ActionForm, which includes a field/getter/setter of "subclass".
The subclass inherits "superField" field/getter/setter from its superclass.
In my JSP page, I try to access the "superField".  But it is complained "no
getter method for subclass.superField in the ActionForm".  See p.s. for
related codes.

Does anybody have any clue?  Is it a limitation of Struts, ActionForm or
only the nested tags?  Is it possibly caused by Real Time Type
Identification/Reflection?  Is it possibly caused by serializable?

Thanks.
Denis

p.s. related codes
1) JSP:
<nested:form action='/myquestion'>
<nested:nest property='scheduleVO'>
<nested:text property='description'/>
...
2) ActionForm:
...
    private ScheduleVO scheduleVO;  //The reference is in the type of
ScheduleVO instead of ScheduleBean
    public ScheduleVO getScheduleVO() {
        return this.scheduleVO;
    }
    public void setScheduleVO(ScheduleVO scheduleVO) {
        this.scheduleVO = scheduleVO;
    }
...
3) ScheduleVO:
public class ScheduleVO extends ScheduleBean {
...
}

4) ScheduleBean, which is in the same package with ScheduleVO:

class ScheduleBean implements Serializable {	//the class is in the scope of
package
...
    String description;	// i tried both package/private level access
modifiers
    public String getDescription() {
        return this.description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
.....
}

p.s.2
In order to narrow down the problem, I did some comparision experiments:
1) Replace "superField" with "subclassLocalField", which is a local filed in
the subclass.  Everything works fine.
2) Replace "superField" with "superField2".  Not working as expected.  Be
sure nothing related to typo.
3) Copy "superField" field/getter/setter from superclass into the subclass.
Everything works fine.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>