You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Moritz Gmelin <mo...@gmx.de> on 2008/02/01 10:02:16 UTC
ClassCastException in CoercingPropertyConduitWrapper
Hi,
I have an Editing page that I would like to use to edit different
object implementing the same class. If I switch the object I want to
edit I get a ClassCastException in the CoercingPropertyConduitWrapper
(see below).
I have created a simple scenario to reproduce this.
First there is a Base Page CoercTest that hast 2 ActionLinks that lead
to the ObjectEditPage
-----------------------------
public class CoercTest {
@InjectPage
private ObjectEditPage editPage;
@OnEvent(component="typeTO1")
public ObjectEditPage onTypeTO1() {
editPage.setTestObject(new TO1());
return editPage;
}
@OnEvent(component="typeTO2")
public ObjectEditPage onTypeTO2() {
editPage.setTestObject(new TO2());
return editPage;
}
}
----------------------------------
TO1 and TO2 both implement TestInterface
This is what ObjectEditPage looks like
-------------------
@Persist
private TestInterface testObject;
public TestInterface getTestObject() {
return testObject;
}
public void setTestObject(TestInterface to) {
this.testObject = to;
}
public Object onSuccess() {
testObject = null;
return CoercTest.class;
}
------------------------
the tml contains just a BeanForm to edit the "testObject"
Now if the user hits the first ActionLink on the CoercTest page, and
submits the form everything looks OK. But as soons as he then hits the
2. ActionLink to edit an Object of the other SubType of TestInterface
he gets the following Exception
------------------------
java.lang.ClassCastException
de.avetana.app.pages.test.TO2
Stack trace
•
org
.apache
.tapestry
.internal
.services
.CoercingPropertyConduitWrapper
.get(CoercingPropertyConduitWrapper.java:36)
• org.apache.tapestry.corelib.components.PropertyEditor
$1.getPropertyValue(PropertyEditor.java:151)
•
org.apache.tapestry.internal.bindings.PropBinding.get(PropBinding.java:
54)
•
org
.apache
.tapestry
.internal
.structure
.InternalComponentResourcesImpl
.readParameter(InternalComponentResourcesImpl.java:209)
•
org
.apache
.tapestry
.internal
.structure
.InternalComponentResourcesImpl
.readParameter(InternalComponentResourcesImpl.java:224)
• org.apache.tapestry.corelib.base.AbstractTextField._
$read_parameter_value(AbstractTextField.java)
•
org
.apache
.tapestry.corelib.base.AbstractTextField.begin(AbstractTextField.java:
154)
•
org
.apache
.tapestry
.corelib.base.AbstractTextField.beginRender(AbstractTextField.java)
• org.apache.tapestry.internal.structure.ComponentPageElementImpl
$10$1.run(ComponentPageElementImpl.java:327)
•
org
.apache
.tapestry
.internal
.structure
.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:869)
•
org.apache.tapestry.internal.structure.ComponentPageElementImpl.access
$100(ComponentPageElementImpl.java:53)
• org.apache.tapestry.internal.structure.ComponentPageElementImpl
$10.render(ComponentPageElementImpl.java:331)
•
org
.apache
.tapestry.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:58)
•
org
.apache
.tapestry
.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:
63)
• org.apache.tapestry.services.TapestryModule
$19.renderMarkup(TapestryModule.java:1291)
• org.apache.tapestry.services.TapestryModule
$23.renderMarkup(TapestryModule.java:1399)
• org.apache.tapestry.services.TapestryModule
$22.renderMarkup(TapestryModule.java:1380)
----------------------------
Is there anything one can do to have EditingPages that can handle more
than one object type?
M.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: ClassCastException in CoercingPropertyConduitWrapper
Posted by Howard Lewis Ship <hl...@gmail.com>.
Please file an issue and I'll look into it in more detail. This
should be working, the BeanEditor should operate in terms of the
properties defined by the interface.
On Feb 4, 2008 12:32 PM, Moritz Gmelin <mo...@gmx.de> wrote:
> Still does not work, even after moving my entities into some other
> package.
>
> TT1 is the superclasss of TT2
>
> What's also very strange is that after editing TT1, submitting and
> then hitting the link to edit TT2, the beanform displays a TT1
> entities (at least the properties of the beanform are TT1 properties).
>
> CoercTest.java
> -----------------------
>
> public class CoercTest {
>
> @Persist
> private TT1 testObject;
>
>
> @OnEvent(component="typeTO1")
> public void onTypeTO1() {
> setTestObject(new TT1());
> }
>
> @OnEvent(component="typeTO2")
> public void onTypeTO2() {
> setTestObject(new TT2());
> }
>
> public TT1 getTestObject() {
> return testObject;
> }
>
> public void setTestObject(TT1 testObject) {
> this.testObject = testObject;
> }
>
> public void onSubmit() {
> testObject = null;
> }
>
> public boolean isTestObjectNotNull() {
> return testObject != null;
> }
>
> }
>
>
> CoercTest.tml
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <body>
> <t:ActionLink t:id="typeTO1">TT1</t:ActionLink><br/>
> <t:ActionLink t:id="typeTO2">TT2</t:ActionLink><br/>
> <t:If test="testObjectNotNull">
> <t:BeanEditForm object="testObject"/>
> </t:If>
> </body>
> </html>
>
>
> Am 04.02.2008 um 19:01 schrieb Howard Lewis Ship:
>
>
> > Only page classes should go in the pages package. You should move your
> > implementations elsewhere. Currently, Tapestry is treating those
> > pages as if they are page components and transforming them (they are,
> > after all, in the folder that designates this) ... and that causes
> > some confusion down-stream.
> >
> > On Feb 4, 2008 4:17 AM, Moritz Gmelin <mo...@gmx.de> wrote:
> >> For one test case, the Implementations are in the same package as the
> >> page itself. For the original problem, the implementations are in a
> >> package outside of the WebApplication. The error occurs in both
> >> situations.
> >>
> >> The error does not occur if the page has no "onSubmit" method. But I
> >> need the method to handle the data....
> >>
> >> M.
> >>
> >> Am 04.02.2008 um 06:21 schrieb Howard Lewis Ship:
> >>
> >>
> >>> In what package are these implementation classes?
> >>>
> >>> On Feb 1, 2008 1:53 AM, Moritz Gmelin <mo...@gmx.de> wrote:
> >>>> P.P.S.
> >>>>
> >>>> If I just hit reload after the exception has occured, the EditPage
> >>>> loads as expected.
> >>>>
> >>>> M.
> >>>>
> >>>> Am 01.02.2008 um 10:03 schrieb Moritz Gmelin:
> >>>>
> >>>>
> >>>>> P.S. this happens with T 5.0.9
> >>>>>
> >>>>> Am 01.02.2008 um 10:02 schrieb Moritz Gmelin:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> I have an Editing page that I would like to use to edit different
> >>>>>> object implementing the same class. If I switch the object I want
> >>>>>> to edit I get a ClassCastException in the
> >>>>>> CoercingPropertyConduitWrapper (see below).
> >>>>>>
> >>>>>> I have created a simple scenario to reproduce this.
> >>>>>>
> >>>>>> First there is a Base Page CoercTest that hast 2 ActionLinks that
> >>>>>> lead to the ObjectEditPage
> >>>>>>
> >>>>>> -----------------------------
> >>>>>>
> >>>>>> public class CoercTest {
> >>>>>>
> >>>>>> @InjectPage
> >>>>>> private ObjectEditPage editPage;
> >>>>>>
> >>>>>> @OnEvent(component="typeTO1")
> >>>>>> public ObjectEditPage onTypeTO1() {
> >>>>>> editPage.setTestObject(new TO1());
> >>>>>> return editPage;
> >>>>>>
> >>>>>> }
> >>>>>>
> >>>>>> @OnEvent(component="typeTO2")
> >>>>>> public ObjectEditPage onTypeTO2() {
> >>>>>> editPage.setTestObject(new TO2());
> >>>>>> return editPage;
> >>>>>>
> >>>>>> }
> >>>>>>
> >>>>>> }
> >>>>>>
> >>>>>> ----------------------------------
> >>>>>>
> >>>>>> TO1 and TO2 both implement TestInterface
> >>>>>>
> >>>>>> This is what ObjectEditPage looks like
> >>>>>>
> >>>>>> -------------------
> >>>>>>
> >>>>>> @Persist
> >>>>>> private TestInterface testObject;
> >>>>>>
> >>>>>> public TestInterface getTestObject() {
> >>>>>> return testObject;
> >>>>>> }
> >>>>>>
> >>>>>> public void setTestObject(TestInterface to) {
> >>>>>> this.testObject = to;
> >>>>>> }
> >>>>>>
> >>>>>> public Object onSuccess() {
> >>>>>> testObject = null;
> >>>>>> return CoercTest.class;
> >>>>>> }
> >>>>>>
> >>>>>> ------------------------
> >>>>>>
> >>>>>> the tml contains just a BeanForm to edit the "testObject"
> >>>>>>
> >>>>>>
> >>>>>> Now if the user hits the first ActionLink on the CoercTest page,
> >>>>>> and submits the form everything looks OK. But as soons as he then
> >>>>>> hits the 2. ActionLink to edit an Object of the other SubType of
> >>>>>> TestInterface he gets the following Exception
> >>>>>>
> >>>>>> ------------------------
> >>>>>>
> >>>>>> java.lang.ClassCastException
> >>>>>> de.avetana.app.pages.test.TO2
> >>>>>> Stack trace
> >>>>>> •
> >>>>>> org
> >>>>>> .apache
> >>>>>> .tapestry
> >>>>>> .internal
> >>>>>> .services
> >>>>>> .CoercingPropertyConduitWrapper
> >>>>>> .get(CoercingPropertyConduitWrapper.java:36)
> >>>>>> •
> >>>>>> org.apache.tapestry.corelib.components.PropertyEditor
> >>>>>> $1.getPropertyValue(PropertyEditor.java:151)
> >>>>>> •
> >>>>>> org
> >>>>>> .apache
> >>>>>> .tapestry.internal.bindings.PropBinding.get(PropBinding.java:
> >>>>>> 54)
> >>>>>> •
> >>>>>> org
> >>>>>> .apache
> >>>>>> .tapestry
> >>>>>> .internal
> >>>>>> .structure
> >>>>>> .InternalComponentResourcesImpl
> >>>>>> .readParameter(InternalComponentResourcesImpl.java:209)
> >>>>>> •
> >>>>>> org
> >>>>>> .apache
> >>>>>> .tapestry
> >>>>>> .internal
> >>>>>> .structure
> >>>>>> .InternalComponentResourcesImpl
> >>>>>> .readParameter(InternalComponentResourcesImpl.java:224)
> >>>>>> • org.apache.tapestry.corelib.base.AbstractTextField._
> >>>>>> $read_parameter_value(AbstractTextField.java)
> >>>>>> •
> >>>>>> org
> >>>>>> .apache
> >>>>>> .tapestry
> >>>>>> .corelib.base.AbstractTextField.begin(AbstractTextField.java:154)
> >>>>>> •
> >>>>>> org
> >>>>>> .apache
> >>>>>> .tapestry
> >>>>>> .corelib
> >>>>>> .base.AbstractTextField.beginRender(AbstractTextField.java)
> >>>>>> •
> >>>>>> org.apache.tapestry.internal.structure.ComponentPageElementImpl
> >>>>>> $10$1.run(ComponentPageElementImpl.java:327)
> >>>>>> •
> >>>>>> org
> >>>>>> .apache
> >>>>>> .tapestry
> >>>>>> .internal
> >>>>>> .structure
> >>>>>> .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:
> >>>>>> 869)
> >>>>>> •
> >>>>>> org
> >>>>>> .apache
> >>>>>> .tapestry.internal.structure.ComponentPageElementImpl.access
> >>>>>> $100(ComponentPageElementImpl.java:53)
> >>>>>> •
> >>>>>> org.apache.tapestry.internal.structure.ComponentPageElementImpl
> >>>>>> $10.render(ComponentPageElementImpl.java:331)
> >>>>>> •
> >>>>>> org
> >>>>>> .apache
> >>>>>> .tapestry
> >>>>>> .internal.services.RenderQueueImpl.run(RenderQueueImpl.java:58)
> >>>>>> •
> >>>>>> org
> >>>>>> .apache
> >>>>>> .tapestry
> >>>>>> .internal
> >>>>>> .services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:63)
> >>>>>> • org.apache.tapestry.services.TapestryModule
> >>>>>> $19.renderMarkup(TapestryModule.java:1291)
> >>>>>> • org.apache.tapestry.services.TapestryModule
> >>>>>> $23.renderMarkup(TapestryModule.java:1399)
> >>>>>> • org.apache.tapestry.services.TapestryModule
> >>>>>> $22.renderMarkup(TapestryModule.java:1380)
> >>>>>>
> >>>>>> ----------------------------
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> Is there anything one can do to have EditingPages that can handle
> >>>>>> more than one object type?
> >>>>>>
> >>>>>> M.
> >>>>>> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>>
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Howard M. Lewis Ship
> >>>
> >>> Creator Apache Tapestry and Apache HiveMind
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> >
> > --
> > Howard M. Lewis Ship
> >
> > Creator Apache Tapestry and Apache HiveMind
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: ClassCastException in CoercingPropertyConduitWrapper
Posted by Moritz Gmelin <mo...@gmx.de>.
Still does not work, even after moving my entities into some other
package.
TT1 is the superclasss of TT2
What's also very strange is that after editing TT1, submitting and
then hitting the link to edit TT2, the beanform displays a TT1
entities (at least the properties of the beanform are TT1 properties).
CoercTest.java
-----------------------
public class CoercTest {
@Persist
private TT1 testObject;
@OnEvent(component="typeTO1")
public void onTypeTO1() {
setTestObject(new TT1());
}
@OnEvent(component="typeTO2")
public void onTypeTO2() {
setTestObject(new TT2());
}
public TT1 getTestObject() {
return testObject;
}
public void setTestObject(TT1 testObject) {
this.testObject = testObject;
}
public void onSubmit() {
testObject = null;
}
public boolean isTestObjectNotNull() {
return testObject != null;
}
}
CoercTest.tml
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<body>
<t:ActionLink t:id="typeTO1">TT1</t:ActionLink><br/>
<t:ActionLink t:id="typeTO2">TT2</t:ActionLink><br/>
<t:If test="testObjectNotNull">
<t:BeanEditForm object="testObject"/>
</t:If>
</body>
</html>
Am 04.02.2008 um 19:01 schrieb Howard Lewis Ship:
> Only page classes should go in the pages package. You should move your
> implementations elsewhere. Currently, Tapestry is treating those
> pages as if they are page components and transforming them (they are,
> after all, in the folder that designates this) ... and that causes
> some confusion down-stream.
>
> On Feb 4, 2008 4:17 AM, Moritz Gmelin <mo...@gmx.de> wrote:
>> For one test case, the Implementations are in the same package as the
>> page itself. For the original problem, the implementations are in a
>> package outside of the WebApplication. The error occurs in both
>> situations.
>>
>> The error does not occur if the page has no "onSubmit" method. But I
>> need the method to handle the data....
>>
>> M.
>>
>> Am 04.02.2008 um 06:21 schrieb Howard Lewis Ship:
>>
>>
>>> In what package are these implementation classes?
>>>
>>> On Feb 1, 2008 1:53 AM, Moritz Gmelin <mo...@gmx.de> wrote:
>>>> P.P.S.
>>>>
>>>> If I just hit reload after the exception has occured, the EditPage
>>>> loads as expected.
>>>>
>>>> M.
>>>>
>>>> Am 01.02.2008 um 10:03 schrieb Moritz Gmelin:
>>>>
>>>>
>>>>> P.S. this happens with T 5.0.9
>>>>>
>>>>> Am 01.02.2008 um 10:02 schrieb Moritz Gmelin:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have an Editing page that I would like to use to edit different
>>>>>> object implementing the same class. If I switch the object I want
>>>>>> to edit I get a ClassCastException in the
>>>>>> CoercingPropertyConduitWrapper (see below).
>>>>>>
>>>>>> I have created a simple scenario to reproduce this.
>>>>>>
>>>>>> First there is a Base Page CoercTest that hast 2 ActionLinks that
>>>>>> lead to the ObjectEditPage
>>>>>>
>>>>>> -----------------------------
>>>>>>
>>>>>> public class CoercTest {
>>>>>>
>>>>>> @InjectPage
>>>>>> private ObjectEditPage editPage;
>>>>>>
>>>>>> @OnEvent(component="typeTO1")
>>>>>> public ObjectEditPage onTypeTO1() {
>>>>>> editPage.setTestObject(new TO1());
>>>>>> return editPage;
>>>>>>
>>>>>> }
>>>>>>
>>>>>> @OnEvent(component="typeTO2")
>>>>>> public ObjectEditPage onTypeTO2() {
>>>>>> editPage.setTestObject(new TO2());
>>>>>> return editPage;
>>>>>>
>>>>>> }
>>>>>>
>>>>>> }
>>>>>>
>>>>>> ----------------------------------
>>>>>>
>>>>>> TO1 and TO2 both implement TestInterface
>>>>>>
>>>>>> This is what ObjectEditPage looks like
>>>>>>
>>>>>> -------------------
>>>>>>
>>>>>> @Persist
>>>>>> private TestInterface testObject;
>>>>>>
>>>>>> public TestInterface getTestObject() {
>>>>>> return testObject;
>>>>>> }
>>>>>>
>>>>>> public void setTestObject(TestInterface to) {
>>>>>> this.testObject = to;
>>>>>> }
>>>>>>
>>>>>> public Object onSuccess() {
>>>>>> testObject = null;
>>>>>> return CoercTest.class;
>>>>>> }
>>>>>>
>>>>>> ------------------------
>>>>>>
>>>>>> the tml contains just a BeanForm to edit the "testObject"
>>>>>>
>>>>>>
>>>>>> Now if the user hits the first ActionLink on the CoercTest page,
>>>>>> and submits the form everything looks OK. But as soons as he then
>>>>>> hits the 2. ActionLink to edit an Object of the other SubType of
>>>>>> TestInterface he gets the following Exception
>>>>>>
>>>>>> ------------------------
>>>>>>
>>>>>> java.lang.ClassCastException
>>>>>> de.avetana.app.pages.test.TO2
>>>>>> Stack trace
>>>>>> •
>>>>>> org
>>>>>> .apache
>>>>>> .tapestry
>>>>>> .internal
>>>>>> .services
>>>>>> .CoercingPropertyConduitWrapper
>>>>>> .get(CoercingPropertyConduitWrapper.java:36)
>>>>>> •
>>>>>> org.apache.tapestry.corelib.components.PropertyEditor
>>>>>> $1.getPropertyValue(PropertyEditor.java:151)
>>>>>> •
>>>>>> org
>>>>>> .apache
>>>>>> .tapestry.internal.bindings.PropBinding.get(PropBinding.java:
>>>>>> 54)
>>>>>> •
>>>>>> org
>>>>>> .apache
>>>>>> .tapestry
>>>>>> .internal
>>>>>> .structure
>>>>>> .InternalComponentResourcesImpl
>>>>>> .readParameter(InternalComponentResourcesImpl.java:209)
>>>>>> •
>>>>>> org
>>>>>> .apache
>>>>>> .tapestry
>>>>>> .internal
>>>>>> .structure
>>>>>> .InternalComponentResourcesImpl
>>>>>> .readParameter(InternalComponentResourcesImpl.java:224)
>>>>>> • org.apache.tapestry.corelib.base.AbstractTextField._
>>>>>> $read_parameter_value(AbstractTextField.java)
>>>>>> •
>>>>>> org
>>>>>> .apache
>>>>>> .tapestry
>>>>>> .corelib.base.AbstractTextField.begin(AbstractTextField.java:154)
>>>>>> •
>>>>>> org
>>>>>> .apache
>>>>>> .tapestry
>>>>>> .corelib
>>>>>> .base.AbstractTextField.beginRender(AbstractTextField.java)
>>>>>> •
>>>>>> org.apache.tapestry.internal.structure.ComponentPageElementImpl
>>>>>> $10$1.run(ComponentPageElementImpl.java:327)
>>>>>> •
>>>>>> org
>>>>>> .apache
>>>>>> .tapestry
>>>>>> .internal
>>>>>> .structure
>>>>>> .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:
>>>>>> 869)
>>>>>> •
>>>>>> org
>>>>>> .apache
>>>>>> .tapestry.internal.structure.ComponentPageElementImpl.access
>>>>>> $100(ComponentPageElementImpl.java:53)
>>>>>> •
>>>>>> org.apache.tapestry.internal.structure.ComponentPageElementImpl
>>>>>> $10.render(ComponentPageElementImpl.java:331)
>>>>>> •
>>>>>> org
>>>>>> .apache
>>>>>> .tapestry
>>>>>> .internal.services.RenderQueueImpl.run(RenderQueueImpl.java:58)
>>>>>> •
>>>>>> org
>>>>>> .apache
>>>>>> .tapestry
>>>>>> .internal
>>>>>> .services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:63)
>>>>>> • org.apache.tapestry.services.TapestryModule
>>>>>> $19.renderMarkup(TapestryModule.java:1291)
>>>>>> • org.apache.tapestry.services.TapestryModule
>>>>>> $23.renderMarkup(TapestryModule.java:1399)
>>>>>> • org.apache.tapestry.services.TapestryModule
>>>>>> $22.renderMarkup(TapestryModule.java:1380)
>>>>>>
>>>>>> ----------------------------
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Is there anything one can do to have EditingPages that can handle
>>>>>> more than one object type?
>>>>>>
>>>>>> M.
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Howard M. Lewis Ship
>>>
>>> Creator Apache Tapestry and Apache HiveMind
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
Re: ClassCastException in CoercingPropertyConduitWrapper
Posted by Howard Lewis Ship <hl...@gmail.com>.
Only page classes should go in the pages package. You should move your
implementations elsewhere. Currently, Tapestry is treating those
pages as if they are page components and transforming them (they are,
after all, in the folder that designates this) ... and that causes
some confusion down-stream.
On Feb 4, 2008 4:17 AM, Moritz Gmelin <mo...@gmx.de> wrote:
> For one test case, the Implementations are in the same package as the
> page itself. For the original problem, the implementations are in a
> package outside of the WebApplication. The error occurs in both
> situations.
>
> The error does not occur if the page has no "onSubmit" method. But I
> need the method to handle the data....
>
> M.
>
> Am 04.02.2008 um 06:21 schrieb Howard Lewis Ship:
>
>
> > In what package are these implementation classes?
> >
> > On Feb 1, 2008 1:53 AM, Moritz Gmelin <mo...@gmx.de> wrote:
> >> P.P.S.
> >>
> >> If I just hit reload after the exception has occured, the EditPage
> >> loads as expected.
> >>
> >> M.
> >>
> >> Am 01.02.2008 um 10:03 schrieb Moritz Gmelin:
> >>
> >>
> >>> P.S. this happens with T 5.0.9
> >>>
> >>> Am 01.02.2008 um 10:02 schrieb Moritz Gmelin:
> >>>
> >>>> Hi,
> >>>>
> >>>> I have an Editing page that I would like to use to edit different
> >>>> object implementing the same class. If I switch the object I want
> >>>> to edit I get a ClassCastException in the
> >>>> CoercingPropertyConduitWrapper (see below).
> >>>>
> >>>> I have created a simple scenario to reproduce this.
> >>>>
> >>>> First there is a Base Page CoercTest that hast 2 ActionLinks that
> >>>> lead to the ObjectEditPage
> >>>>
> >>>> -----------------------------
> >>>>
> >>>> public class CoercTest {
> >>>>
> >>>> @InjectPage
> >>>> private ObjectEditPage editPage;
> >>>>
> >>>> @OnEvent(component="typeTO1")
> >>>> public ObjectEditPage onTypeTO1() {
> >>>> editPage.setTestObject(new TO1());
> >>>> return editPage;
> >>>>
> >>>> }
> >>>>
> >>>> @OnEvent(component="typeTO2")
> >>>> public ObjectEditPage onTypeTO2() {
> >>>> editPage.setTestObject(new TO2());
> >>>> return editPage;
> >>>>
> >>>> }
> >>>>
> >>>> }
> >>>>
> >>>> ----------------------------------
> >>>>
> >>>> TO1 and TO2 both implement TestInterface
> >>>>
> >>>> This is what ObjectEditPage looks like
> >>>>
> >>>> -------------------
> >>>>
> >>>> @Persist
> >>>> private TestInterface testObject;
> >>>>
> >>>> public TestInterface getTestObject() {
> >>>> return testObject;
> >>>> }
> >>>>
> >>>> public void setTestObject(TestInterface to) {
> >>>> this.testObject = to;
> >>>> }
> >>>>
> >>>> public Object onSuccess() {
> >>>> testObject = null;
> >>>> return CoercTest.class;
> >>>> }
> >>>>
> >>>> ------------------------
> >>>>
> >>>> the tml contains just a BeanForm to edit the "testObject"
> >>>>
> >>>>
> >>>> Now if the user hits the first ActionLink on the CoercTest page,
> >>>> and submits the form everything looks OK. But as soons as he then
> >>>> hits the 2. ActionLink to edit an Object of the other SubType of
> >>>> TestInterface he gets the following Exception
> >>>>
> >>>> ------------------------
> >>>>
> >>>> java.lang.ClassCastException
> >>>> de.avetana.app.pages.test.TO2
> >>>> Stack trace
> >>>> •
> >>>> org
> >>>> .apache
> >>>> .tapestry
> >>>> .internal
> >>>> .services
> >>>> .CoercingPropertyConduitWrapper
> >>>> .get(CoercingPropertyConduitWrapper.java:36)
> >>>> • org.apache.tapestry.corelib.components.PropertyEditor
> >>>> $1.getPropertyValue(PropertyEditor.java:151)
> >>>> •
> >>>> org
> >>>> .apache
> >>>> .tapestry.internal.bindings.PropBinding.get(PropBinding.java:
> >>>> 54)
> >>>> •
> >>>> org
> >>>> .apache
> >>>> .tapestry
> >>>> .internal
> >>>> .structure
> >>>> .InternalComponentResourcesImpl
> >>>> .readParameter(InternalComponentResourcesImpl.java:209)
> >>>> •
> >>>> org
> >>>> .apache
> >>>> .tapestry
> >>>> .internal
> >>>> .structure
> >>>> .InternalComponentResourcesImpl
> >>>> .readParameter(InternalComponentResourcesImpl.java:224)
> >>>> • org.apache.tapestry.corelib.base.AbstractTextField._
> >>>> $read_parameter_value(AbstractTextField.java)
> >>>> •
> >>>> org
> >>>> .apache
> >>>> .tapestry
> >>>> .corelib.base.AbstractTextField.begin(AbstractTextField.java:154)
> >>>> •
> >>>> org
> >>>> .apache
> >>>> .tapestry
> >>>> .corelib.base.AbstractTextField.beginRender(AbstractTextField.java)
> >>>> •
> >>>> org.apache.tapestry.internal.structure.ComponentPageElementImpl
> >>>> $10$1.run(ComponentPageElementImpl.java:327)
> >>>> •
> >>>> org
> >>>> .apache
> >>>> .tapestry
> >>>> .internal
> >>>> .structure
> >>>> .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:869)
> >>>> •
> >>>> org
> >>>> .apache.tapestry.internal.structure.ComponentPageElementImpl.access
> >>>> $100(ComponentPageElementImpl.java:53)
> >>>> •
> >>>> org.apache.tapestry.internal.structure.ComponentPageElementImpl
> >>>> $10.render(ComponentPageElementImpl.java:331)
> >>>> •
> >>>> org
> >>>> .apache
> >>>> .tapestry
> >>>> .internal.services.RenderQueueImpl.run(RenderQueueImpl.java:58)
> >>>> •
> >>>> org
> >>>> .apache
> >>>> .tapestry
> >>>> .internal
> >>>> .services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:63)
> >>>> • org.apache.tapestry.services.TapestryModule
> >>>> $19.renderMarkup(TapestryModule.java:1291)
> >>>> • org.apache.tapestry.services.TapestryModule
> >>>> $23.renderMarkup(TapestryModule.java:1399)
> >>>> • org.apache.tapestry.services.TapestryModule
> >>>> $22.renderMarkup(TapestryModule.java:1380)
> >>>>
> >>>> ----------------------------
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Is there anything one can do to have EditingPages that can handle
> >>>> more than one object type?
> >>>>
> >>>> M.
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> >
> > --
> > Howard M. Lewis Ship
> >
> > Creator Apache Tapestry and Apache HiveMind
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: ClassCastException in CoercingPropertyConduitWrapper
Posted by Moritz Gmelin <mo...@gmx.de>.
For one test case, the Implementations are in the same package as the
page itself. For the original problem, the implementations are in a
package outside of the WebApplication. The error occurs in both
situations.
The error does not occur if the page has no "onSubmit" method. But I
need the method to handle the data....
M.
Am 04.02.2008 um 06:21 schrieb Howard Lewis Ship:
> In what package are these implementation classes?
>
> On Feb 1, 2008 1:53 AM, Moritz Gmelin <mo...@gmx.de> wrote:
>> P.P.S.
>>
>> If I just hit reload after the exception has occured, the EditPage
>> loads as expected.
>>
>> M.
>>
>> Am 01.02.2008 um 10:03 schrieb Moritz Gmelin:
>>
>>
>>> P.S. this happens with T 5.0.9
>>>
>>> Am 01.02.2008 um 10:02 schrieb Moritz Gmelin:
>>>
>>>> Hi,
>>>>
>>>> I have an Editing page that I would like to use to edit different
>>>> object implementing the same class. If I switch the object I want
>>>> to edit I get a ClassCastException in the
>>>> CoercingPropertyConduitWrapper (see below).
>>>>
>>>> I have created a simple scenario to reproduce this.
>>>>
>>>> First there is a Base Page CoercTest that hast 2 ActionLinks that
>>>> lead to the ObjectEditPage
>>>>
>>>> -----------------------------
>>>>
>>>> public class CoercTest {
>>>>
>>>> @InjectPage
>>>> private ObjectEditPage editPage;
>>>>
>>>> @OnEvent(component="typeTO1")
>>>> public ObjectEditPage onTypeTO1() {
>>>> editPage.setTestObject(new TO1());
>>>> return editPage;
>>>>
>>>> }
>>>>
>>>> @OnEvent(component="typeTO2")
>>>> public ObjectEditPage onTypeTO2() {
>>>> editPage.setTestObject(new TO2());
>>>> return editPage;
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>> ----------------------------------
>>>>
>>>> TO1 and TO2 both implement TestInterface
>>>>
>>>> This is what ObjectEditPage looks like
>>>>
>>>> -------------------
>>>>
>>>> @Persist
>>>> private TestInterface testObject;
>>>>
>>>> public TestInterface getTestObject() {
>>>> return testObject;
>>>> }
>>>>
>>>> public void setTestObject(TestInterface to) {
>>>> this.testObject = to;
>>>> }
>>>>
>>>> public Object onSuccess() {
>>>> testObject = null;
>>>> return CoercTest.class;
>>>> }
>>>>
>>>> ------------------------
>>>>
>>>> the tml contains just a BeanForm to edit the "testObject"
>>>>
>>>>
>>>> Now if the user hits the first ActionLink on the CoercTest page,
>>>> and submits the form everything looks OK. But as soons as he then
>>>> hits the 2. ActionLink to edit an Object of the other SubType of
>>>> TestInterface he gets the following Exception
>>>>
>>>> ------------------------
>>>>
>>>> java.lang.ClassCastException
>>>> de.avetana.app.pages.test.TO2
>>>> Stack trace
>>>> •
>>>> org
>>>> .apache
>>>> .tapestry
>>>> .internal
>>>> .services
>>>> .CoercingPropertyConduitWrapper
>>>> .get(CoercingPropertyConduitWrapper.java:36)
>>>> • org.apache.tapestry.corelib.components.PropertyEditor
>>>> $1.getPropertyValue(PropertyEditor.java:151)
>>>> •
>>>> org
>>>> .apache
>>>> .tapestry.internal.bindings.PropBinding.get(PropBinding.java:
>>>> 54)
>>>> •
>>>> org
>>>> .apache
>>>> .tapestry
>>>> .internal
>>>> .structure
>>>> .InternalComponentResourcesImpl
>>>> .readParameter(InternalComponentResourcesImpl.java:209)
>>>> •
>>>> org
>>>> .apache
>>>> .tapestry
>>>> .internal
>>>> .structure
>>>> .InternalComponentResourcesImpl
>>>> .readParameter(InternalComponentResourcesImpl.java:224)
>>>> • org.apache.tapestry.corelib.base.AbstractTextField._
>>>> $read_parameter_value(AbstractTextField.java)
>>>> •
>>>> org
>>>> .apache
>>>> .tapestry
>>>> .corelib.base.AbstractTextField.begin(AbstractTextField.java:154)
>>>> •
>>>> org
>>>> .apache
>>>> .tapestry
>>>> .corelib.base.AbstractTextField.beginRender(AbstractTextField.java)
>>>> •
>>>> org.apache.tapestry.internal.structure.ComponentPageElementImpl
>>>> $10$1.run(ComponentPageElementImpl.java:327)
>>>> •
>>>> org
>>>> .apache
>>>> .tapestry
>>>> .internal
>>>> .structure
>>>> .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:869)
>>>> •
>>>> org
>>>> .apache.tapestry.internal.structure.ComponentPageElementImpl.access
>>>> $100(ComponentPageElementImpl.java:53)
>>>> •
>>>> org.apache.tapestry.internal.structure.ComponentPageElementImpl
>>>> $10.render(ComponentPageElementImpl.java:331)
>>>> •
>>>> org
>>>> .apache
>>>> .tapestry
>>>> .internal.services.RenderQueueImpl.run(RenderQueueImpl.java:58)
>>>> •
>>>> org
>>>> .apache
>>>> .tapestry
>>>> .internal
>>>> .services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:63)
>>>> • org.apache.tapestry.services.TapestryModule
>>>> $19.renderMarkup(TapestryModule.java:1291)
>>>> • org.apache.tapestry.services.TapestryModule
>>>> $23.renderMarkup(TapestryModule.java:1399)
>>>> • org.apache.tapestry.services.TapestryModule
>>>> $22.renderMarkup(TapestryModule.java:1380)
>>>>
>>>> ----------------------------
>>>>
>>>>
>>>>
>>>>
>>>> Is there anything one can do to have EditingPages that can handle
>>>> more than one object type?
>>>>
>>>> M.
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: ClassCastException in CoercingPropertyConduitWrapper
Posted by Howard Lewis Ship <hl...@gmail.com>.
In what package are these implementation classes?
On Feb 1, 2008 1:53 AM, Moritz Gmelin <mo...@gmx.de> wrote:
> P.P.S.
>
> If I just hit reload after the exception has occured, the EditPage
> loads as expected.
>
> M.
>
> Am 01.02.2008 um 10:03 schrieb Moritz Gmelin:
>
>
> > P.S. this happens with T 5.0.9
> >
> > Am 01.02.2008 um 10:02 schrieb Moritz Gmelin:
> >
> >> Hi,
> >>
> >> I have an Editing page that I would like to use to edit different
> >> object implementing the same class. If I switch the object I want
> >> to edit I get a ClassCastException in the
> >> CoercingPropertyConduitWrapper (see below).
> >>
> >> I have created a simple scenario to reproduce this.
> >>
> >> First there is a Base Page CoercTest that hast 2 ActionLinks that
> >> lead to the ObjectEditPage
> >>
> >> -----------------------------
> >>
> >> public class CoercTest {
> >>
> >> @InjectPage
> >> private ObjectEditPage editPage;
> >>
> >> @OnEvent(component="typeTO1")
> >> public ObjectEditPage onTypeTO1() {
> >> editPage.setTestObject(new TO1());
> >> return editPage;
> >>
> >> }
> >>
> >> @OnEvent(component="typeTO2")
> >> public ObjectEditPage onTypeTO2() {
> >> editPage.setTestObject(new TO2());
> >> return editPage;
> >>
> >> }
> >>
> >> }
> >>
> >> ----------------------------------
> >>
> >> TO1 and TO2 both implement TestInterface
> >>
> >> This is what ObjectEditPage looks like
> >>
> >> -------------------
> >>
> >> @Persist
> >> private TestInterface testObject;
> >>
> >> public TestInterface getTestObject() {
> >> return testObject;
> >> }
> >>
> >> public void setTestObject(TestInterface to) {
> >> this.testObject = to;
> >> }
> >>
> >> public Object onSuccess() {
> >> testObject = null;
> >> return CoercTest.class;
> >> }
> >>
> >> ------------------------
> >>
> >> the tml contains just a BeanForm to edit the "testObject"
> >>
> >>
> >> Now if the user hits the first ActionLink on the CoercTest page,
> >> and submits the form everything looks OK. But as soons as he then
> >> hits the 2. ActionLink to edit an Object of the other SubType of
> >> TestInterface he gets the following Exception
> >>
> >> ------------------------
> >>
> >> java.lang.ClassCastException
> >> de.avetana.app.pages.test.TO2
> >> Stack trace
> >> •
> >> org
> >> .apache
> >> .tapestry
> >> .internal
> >> .services
> >> .CoercingPropertyConduitWrapper
> >> .get(CoercingPropertyConduitWrapper.java:36)
> >> • org.apache.tapestry.corelib.components.PropertyEditor
> >> $1.getPropertyValue(PropertyEditor.java:151)
> >> •
> >> org
> >> .apache.tapestry.internal.bindings.PropBinding.get(PropBinding.java:
> >> 54)
> >> •
> >> org
> >> .apache
> >> .tapestry
> >> .internal
> >> .structure
> >> .InternalComponentResourcesImpl
> >> .readParameter(InternalComponentResourcesImpl.java:209)
> >> •
> >> org
> >> .apache
> >> .tapestry
> >> .internal
> >> .structure
> >> .InternalComponentResourcesImpl
> >> .readParameter(InternalComponentResourcesImpl.java:224)
> >> • org.apache.tapestry.corelib.base.AbstractTextField._
> >> $read_parameter_value(AbstractTextField.java)
> >> •
> >> org
> >> .apache
> >> .tapestry
> >> .corelib.base.AbstractTextField.begin(AbstractTextField.java:154)
> >> •
> >> org
> >> .apache
> >> .tapestry
> >> .corelib.base.AbstractTextField.beginRender(AbstractTextField.java)
> >> • org.apache.tapestry.internal.structure.ComponentPageElementImpl
> >> $10$1.run(ComponentPageElementImpl.java:327)
> >> •
> >> org
> >> .apache
> >> .tapestry
> >> .internal
> >> .structure
> >> .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:869)
> >> •
> >> org
> >> .apache.tapestry.internal.structure.ComponentPageElementImpl.access
> >> $100(ComponentPageElementImpl.java:53)
> >> • org.apache.tapestry.internal.structure.ComponentPageElementImpl
> >> $10.render(ComponentPageElementImpl.java:331)
> >> •
> >> org
> >> .apache
> >> .tapestry
> >> .internal.services.RenderQueueImpl.run(RenderQueueImpl.java:58)
> >> •
> >> org
> >> .apache
> >> .tapestry
> >> .internal
> >> .services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:63)
> >> • org.apache.tapestry.services.TapestryModule
> >> $19.renderMarkup(TapestryModule.java:1291)
> >> • org.apache.tapestry.services.TapestryModule
> >> $23.renderMarkup(TapestryModule.java:1399)
> >> • org.apache.tapestry.services.TapestryModule
> >> $22.renderMarkup(TapestryModule.java:1380)
> >>
> >> ----------------------------
> >>
> >>
> >>
> >>
> >> Is there anything one can do to have EditingPages that can handle
> >> more than one object type?
> >>
> >> M.
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: ClassCastException in CoercingPropertyConduitWrapper
Posted by Moritz Gmelin <mo...@gmx.de>.
P.P.S.
If I just hit reload after the exception has occured, the EditPage
loads as expected.
M.
Am 01.02.2008 um 10:03 schrieb Moritz Gmelin:
> P.S. this happens with T 5.0.9
>
> Am 01.02.2008 um 10:02 schrieb Moritz Gmelin:
>
>> Hi,
>>
>> I have an Editing page that I would like to use to edit different
>> object implementing the same class. If I switch the object I want
>> to edit I get a ClassCastException in the
>> CoercingPropertyConduitWrapper (see below).
>>
>> I have created a simple scenario to reproduce this.
>>
>> First there is a Base Page CoercTest that hast 2 ActionLinks that
>> lead to the ObjectEditPage
>>
>> -----------------------------
>>
>> public class CoercTest {
>>
>> @InjectPage
>> private ObjectEditPage editPage;
>>
>> @OnEvent(component="typeTO1")
>> public ObjectEditPage onTypeTO1() {
>> editPage.setTestObject(new TO1());
>> return editPage;
>>
>> }
>>
>> @OnEvent(component="typeTO2")
>> public ObjectEditPage onTypeTO2() {
>> editPage.setTestObject(new TO2());
>> return editPage;
>>
>> }
>>
>> }
>>
>> ----------------------------------
>>
>> TO1 and TO2 both implement TestInterface
>>
>> This is what ObjectEditPage looks like
>>
>> -------------------
>>
>> @Persist
>> private TestInterface testObject;
>>
>> public TestInterface getTestObject() {
>> return testObject;
>> }
>>
>> public void setTestObject(TestInterface to) {
>> this.testObject = to;
>> }
>>
>> public Object onSuccess() {
>> testObject = null;
>> return CoercTest.class;
>> }
>>
>> ------------------------
>>
>> the tml contains just a BeanForm to edit the "testObject"
>>
>>
>> Now if the user hits the first ActionLink on the CoercTest page,
>> and submits the form everything looks OK. But as soons as he then
>> hits the 2. ActionLink to edit an Object of the other SubType of
>> TestInterface he gets the following Exception
>>
>> ------------------------
>>
>> java.lang.ClassCastException
>> de.avetana.app.pages.test.TO2
>> Stack trace
>> •
>> org
>> .apache
>> .tapestry
>> .internal
>> .services
>> .CoercingPropertyConduitWrapper
>> .get(CoercingPropertyConduitWrapper.java:36)
>> • org.apache.tapestry.corelib.components.PropertyEditor
>> $1.getPropertyValue(PropertyEditor.java:151)
>> •
>> org
>> .apache.tapestry.internal.bindings.PropBinding.get(PropBinding.java:
>> 54)
>> •
>> org
>> .apache
>> .tapestry
>> .internal
>> .structure
>> .InternalComponentResourcesImpl
>> .readParameter(InternalComponentResourcesImpl.java:209)
>> •
>> org
>> .apache
>> .tapestry
>> .internal
>> .structure
>> .InternalComponentResourcesImpl
>> .readParameter(InternalComponentResourcesImpl.java:224)
>> • org.apache.tapestry.corelib.base.AbstractTextField._
>> $read_parameter_value(AbstractTextField.java)
>> •
>> org
>> .apache
>> .tapestry
>> .corelib.base.AbstractTextField.begin(AbstractTextField.java:154)
>> •
>> org
>> .apache
>> .tapestry
>> .corelib.base.AbstractTextField.beginRender(AbstractTextField.java)
>> • org.apache.tapestry.internal.structure.ComponentPageElementImpl
>> $10$1.run(ComponentPageElementImpl.java:327)
>> •
>> org
>> .apache
>> .tapestry
>> .internal
>> .structure
>> .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:869)
>> •
>> org
>> .apache.tapestry.internal.structure.ComponentPageElementImpl.access
>> $100(ComponentPageElementImpl.java:53)
>> • org.apache.tapestry.internal.structure.ComponentPageElementImpl
>> $10.render(ComponentPageElementImpl.java:331)
>> •
>> org
>> .apache
>> .tapestry
>> .internal.services.RenderQueueImpl.run(RenderQueueImpl.java:58)
>> •
>> org
>> .apache
>> .tapestry
>> .internal
>> .services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:63)
>> • org.apache.tapestry.services.TapestryModule
>> $19.renderMarkup(TapestryModule.java:1291)
>> • org.apache.tapestry.services.TapestryModule
>> $23.renderMarkup(TapestryModule.java:1399)
>> • org.apache.tapestry.services.TapestryModule
>> $22.renderMarkup(TapestryModule.java:1380)
>>
>> ----------------------------
>>
>>
>>
>>
>> Is there anything one can do to have EditingPages that can handle
>> more than one object type?
>>
>> M.
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: ClassCastException in CoercingPropertyConduitWrapper
Posted by Moritz Gmelin <mo...@gmx.de>.
P.S. this happens with T 5.0.9
Am 01.02.2008 um 10:02 schrieb Moritz Gmelin:
> Hi,
>
> I have an Editing page that I would like to use to edit different
> object implementing the same class. If I switch the object I want to
> edit I get a ClassCastException in the
> CoercingPropertyConduitWrapper (see below).
>
> I have created a simple scenario to reproduce this.
>
> First there is a Base Page CoercTest that hast 2 ActionLinks that
> lead to the ObjectEditPage
>
> -----------------------------
>
> public class CoercTest {
>
> @InjectPage
> private ObjectEditPage editPage;
>
> @OnEvent(component="typeTO1")
> public ObjectEditPage onTypeTO1() {
> editPage.setTestObject(new TO1());
> return editPage;
>
> }
>
> @OnEvent(component="typeTO2")
> public ObjectEditPage onTypeTO2() {
> editPage.setTestObject(new TO2());
> return editPage;
>
> }
>
> }
>
> ----------------------------------
>
> TO1 and TO2 both implement TestInterface
>
> This is what ObjectEditPage looks like
>
> -------------------
>
> @Persist
> private TestInterface testObject;
>
> public TestInterface getTestObject() {
> return testObject;
> }
>
> public void setTestObject(TestInterface to) {
> this.testObject = to;
> }
>
> public Object onSuccess() {
> testObject = null;
> return CoercTest.class;
> }
>
> ------------------------
>
> the tml contains just a BeanForm to edit the "testObject"
>
>
> Now if the user hits the first ActionLink on the CoercTest page,
> and submits the form everything looks OK. But as soons as he then
> hits the 2. ActionLink to edit an Object of the other SubType of
> TestInterface he gets the following Exception
>
> ------------------------
>
> java.lang.ClassCastException
> de.avetana.app.pages.test.TO2
> Stack trace
> •
> org
> .apache
> .tapestry
> .internal
> .services
> .CoercingPropertyConduitWrapper
> .get(CoercingPropertyConduitWrapper.java:36)
> • org.apache.tapestry.corelib.components.PropertyEditor
> $1.getPropertyValue(PropertyEditor.java:151)
> •
> org
> .apache.tapestry.internal.bindings.PropBinding.get(PropBinding.java:
> 54)
> •
> org
> .apache
> .tapestry
> .internal
> .structure
> .InternalComponentResourcesImpl
> .readParameter(InternalComponentResourcesImpl.java:209)
> •
> org
> .apache
> .tapestry
> .internal
> .structure
> .InternalComponentResourcesImpl
> .readParameter(InternalComponentResourcesImpl.java:224)
> • org.apache.tapestry.corelib.base.AbstractTextField._
> $read_parameter_value(AbstractTextField.java)
> •
> org
> .apache
> .tapestry
> .corelib.base.AbstractTextField.begin(AbstractTextField.java:154)
> •
> org
> .apache
> .tapestry
> .corelib.base.AbstractTextField.beginRender(AbstractTextField.java)
> • org.apache.tapestry.internal.structure.ComponentPageElementImpl
> $10$1.run(ComponentPageElementImpl.java:327)
> •
> org
> .apache
> .tapestry
> .internal
> .structure
> .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:869)
> •
> org
> .apache.tapestry.internal.structure.ComponentPageElementImpl.access
> $100(ComponentPageElementImpl.java:53)
> • org.apache.tapestry.internal.structure.ComponentPageElementImpl
> $10.render(ComponentPageElementImpl.java:331)
> •
> org
> .apache
> .tapestry.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:
> 58)
> •
> org
> .apache
> .tapestry
> .internal
> .services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:63)
> • org.apache.tapestry.services.TapestryModule
> $19.renderMarkup(TapestryModule.java:1291)
> • org.apache.tapestry.services.TapestryModule
> $23.renderMarkup(TapestryModule.java:1399)
> • org.apache.tapestry.services.TapestryModule
> $22.renderMarkup(TapestryModule.java:1380)
>
> ----------------------------
>
>
>
>
> Is there anything one can do to have EditingPages that can handle
> more than one object type?
>
> M.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org