[ 
https://issues.apache.org/jira/browse/TAPESTRY-1908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542171
 ] 

Howard M. Lewis Ship commented on TAPESTRY-1908:
------------------------------------------------

I believe you are tripping across code related to auto-instantiating your bean 
instance.  I can look into whether we can work from the BeanModel rather than 
the type of property bound to the object parameter.  If you provide a prepare 
event handler that instantiates the entity object, that may rectify the problem.

> BeanEditorForm does not use class supplied via optional model
> -------------------------------------------------------------
>
>                 Key: TAPESTRY-1908
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1908
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.6
>         Environment: Java 1.5
>            Reporter: Ezra Epstein
>
> The guide document for the BeanEditForm 
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html 
> states under the "Providing the BeanModel" heading: "...For example, if the 
> the type of the property being edited is an interface type, it may be useful 
> to provide an explicit BeanModel around an underlying implementation class."
> I've been trying this and get a variety of exceptions depending on which way 
> I go.
> .tml:
>       <form t:type="beaneditform" object="entity" model="model" />
> .java:
>     If getEntity() returns the exact concrete class this works fine.  But,
> if getEntity() returns a concrete superclass a ClassCastException is thrown.  
> If getEntity() returns an interface or an abstract superclass then a 
> org.apache.tapestry.ioc.internal.util.TapestryException is thrown with a 
> message stating: "Exception instantiating instance of ..."
> I'm guessing that the BeadEditorForm is using the return type of the 
> getEntity() method in preference to the class I specify on the model.  
> Note: the use case is a bit hyper-dynamic and sneaky.  I'm using (or trying 
> to use) Tap5 as an HTML front-end to a generic REST entity service.  The 
> service takes XML and I wanted to add a simple HTML interface to it.  Thus 
> the actual class of the entity is determined via a request parameter.  I can 
> dynamically set the class in the model but not the getEntity()'s return type.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to