You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ben Dinnerville <be...@voicelogic.com.au> on 2010/10/06 15:19:40 UTC

[T5] issue with coercion in loop (not in form)

hi All,

I am getting a coercion error when using 5.1.0.5 and a loop - not inside 
a form.

The strange thing is, I have provided both a ValueEncoder and 
contributed a Coercion to no avail.

Here is the start of the error:

BeginRender[calltrack/Services:loop]: Failure writing parameter 'value' 
of component calltrack/Services:loop: Could not find a coercion from 
type 
au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService to 
type 
au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService. 
Available coercions: Double --> Float, Float --> Double, Long --> 
Boolean, Long --> Byte, Long --> Double, Long --> Integer, Long --> 
Short, Number --> Long, Object --> Object[], Object --> String, Object 
--> java.util.List, Object[] --> java.util.List, String --> Boolean, 
String --> Double, String --> Long, String --> java.io.File, String --> 
java.math.BigDecimal, String --> java.math.BigInteger, String --> 
java.text.DateFormat, String --> java.util.regex.Pattern, String --> 
org.apache.tapestry5.Renderable, String --> 
org.apache.tapestry5.SelectModel, String --> 
org.apache.tapestry5.corelib.LoopFormState, String --> 
org.apache.tapestry5.corelib.data.BlankOption, String --> 
org.apache.tapestry5.corelib.data.GridPagerPosition, String --> 
org.apache.tapestry5.corelib.data.InsertPosition, String --> 
org.apache.tapestry5.ioc.Resource, String --> 
org.apache.tapestry5.ioc.util.TimeInterval, 
au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService 
--> 
au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService, 
boolean[] --> java.util.List, byte[] --> java.util.List, char[] --> 
java.util.List, double[] --> java.util.List, float[] --> java.util.List, 
int[] --> java.util.List, java.math.BigDecimal --> Double, 
java.util.Collection --> Boolean, java.util.Collection --> Object[], 
java.util.Collection --> org.apache.tapestry5.grid.GridDataSource, 
java.util.List --> org.apache.tapestry5.SelectModel, java.util.Map -->

Note how it is trying to coerce from and to the same class and that if 
you read down further, there is an explicit coercion covering that class 
(CallTrackService)

I have tried this with a grid component as well with the same result. 
What gets me is why a coercion is even happening - there is no form 
here. The tml extract is:

<tr>
	 <t:loop source="callTrackServices" value="currentService" 
encoder="callTrackEncoder" volatile="true" formState="none">
		<td><a href="#" t:context="${currentService.id}" t:type="PageLink" 
t:page="calltrack/ServicesEdit">${currentService.id}</a></td>
		<td>${currentService.aliasPhoneNumber}</td>
		<td>${currentService.privatePhoneNumber}</td>
		<td>${currentService.terminatingPhoneNumber}</td>
		<td>${currentService.recordingEnabled}</td>
		<td>${currentService.voicemailEnabled}</td>
		<td>${currentService.provisionTime}</td>
		<td>
			<t:if test="${currentService.aliasPhoneNumber}"><a href="#" 
t:Type="PageLink" t:page="calltrack/ServicesRemove" 
t:context="${currentService.id}">Remove</a>
			<p:else><br /></p:else>
			</t:if>
		</td>
		</t:loop>
	</tr>

Have tried everything on this one, as per other posts out there, this 
was working on 5.0.18

Any ideas anyone?

Cheers,

Ben


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] issue with coercion in loop (not in form)

Posted by Fanzhen <fa...@hotmail.com>.
  do you have another loop in your page tml?  or a component using a loop.

formState="none" are also required!!!


On 2010-10-6 21:19, Ben Dinnerville wrote:
> hi All,
>
> I am getting a coercion error when using 5.1.0.5 and a loop - not 
> inside a form.
>
> The strange thing is, I have provided both a ValueEncoder and 
> contributed a Coercion to no avail.
>
> Here is the start of the error:
>
> BeginRender[calltrack/Services:loop]: Failure writing parameter 
> 'value' of component calltrack/Services:loop: Could not find a 
> coercion from type 
> au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService 
> to type 
> au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService. 
> Available coercions: Double --> Float, Float --> Double, Long --> 
> Boolean, Long --> Byte, Long --> Double, Long --> Integer, Long --> 
> Short, Number --> Long, Object --> Object[], Object --> String, Object 
> --> java.util.List, Object[] --> java.util.List, String --> Boolean, 
> String --> Double, String --> Long, String --> java.io.File, String 
> --> java.math.BigDecimal, String --> java.math.BigInteger, String --> 
> java.text.DateFormat, String --> java.util.regex.Pattern, String --> 
> org.apache.tapestry5.Renderable, String --> 
> org.apache.tapestry5.SelectModel, String --> 
> org.apache.tapestry5.corelib.LoopFormState, String --> 
> org.apache.tapestry5.corelib.data.BlankOption, String --> 
> org.apache.tapestry5.corelib.data.GridPagerPosition, String --> 
> org.apache.tapestry5.corelib.data.InsertPosition, String --> 
> org.apache.tapestry5.ioc.Resource, String --> 
> org.apache.tapestry5.ioc.util.TimeInterval, 
> au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService 
> --> 
> au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService, 
> boolean[] --> java.util.List, byte[] --> java.util.List, char[] --> 
> java.util.List, double[] --> java.util.List, float[] --> 
> java.util.List, int[] --> java.util.List, java.math.BigDecimal --> 
> Double, java.util.Collection --> Boolean, java.util.Collection --> 
> Object[], java.util.Collection --> 
> org.apache.tapestry5.grid.GridDataSource, java.util.List --> 
> org.apache.tapestry5.SelectModel, java.util.Map -->
>
> Note how it is trying to coerce from and to the same class and that if 
> you read down further, there is an explicit coercion covering that 
> class (CallTrackService)
>
> I have tried this with a grid component as well with the same result. 
> What gets me is why a coercion is even happening - there is no form 
> here. The tml extract is:
>
> <tr>
> <t:loop source="callTrackServices" value="currentService" 
> encoder="callTrackEncoder" volatile="true" formState="none">
> <td><a href="#" t:context="${currentService.id}" t:type="PageLink" 
> t:page="calltrack/ServicesEdit">${currentService.id}</a></td>
> <td>${currentService.aliasPhoneNumber}</td>
> <td>${currentService.privatePhoneNumber}</td>
> <td>${currentService.terminatingPhoneNumber}</td>
> <td>${currentService.recordingEnabled}</td>
> <td>${currentService.voicemailEnabled}</td>
> <td>${currentService.provisionTime}</td>
> <td>
> <t:if test="${currentService.aliasPhoneNumber}"><a href="#" 
> t:Type="PageLink" t:page="calltrack/ServicesRemove" 
> t:context="${currentService.id}">Remove</a>
> <p:else><br /></p:else>
> </t:if>
> </td>
> </t:loop>
> </tr>
>
> Have tried everything on this one, as per other posts out there, this 
> was working on 5.0.18
>
> Any ideas anyone?
>
> Cheers,
>
> Ben
>
>
> ---------------------------------------------------------------------
> 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: [T5] issue with coercion in loop (not in form)

Posted by Josh Canfield <jo...@gmail.com>.
> <t:loop source="callTrackServices" value="currentService" encoder="callTrackEncoder" volatile="true" formState="none">

Your loop calls the setter for the value parameter on every iteration.
If the types do not match then tapestry happily tries to make a match
and coerce them for you. For instance, if your source is List<Integer>
and your value is Long then Integer pulled from the list is coerced
into a Long so it can be stored in your value.

For some reason Tapestry doesn't believe that your value and source
types match. My first guess would be that your model classes are
transformed and share the same package and name, but not the same
classloader/bytecode. Is that plausible?

Also, Are you defining a coercion with the same source and target
type? That seems strange.
> Available coercions:
...
> au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService -->
> au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService,


Josh

On Wed, Oct 6, 2010 at 6:19 AM, Ben Dinnerville <be...@voicelogic.com.au> wrote:
> hi All,
>
> I am getting a coercion error when using 5.1.0.5 and a loop - not inside a
> form.
>
> The strange thing is, I have provided both a ValueEncoder and contributed a
> Coercion to no avail.
>
> Here is the start of the error:
>
> BeginRender[calltrack/Services:loop]: Failure writing parameter 'value' of
> component calltrack/Services:loop: Could not find a coercion from type
> au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService to
> type au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService.
> Available coercions: Double --> Float, Float --> Double, Long --> Boolean,
> Long --> Byte, Long --> Double, Long --> Integer, Long --> Short, Number -->
> Long, Object --> Object[], Object --> String, Object --> java.util.List,
> Object[] --> java.util.List, String --> Boolean, String --> Double, String
> --> Long, String --> java.io.File, String --> java.math.BigDecimal, String
> --> java.math.BigInteger, String --> java.text.DateFormat, String -->
> java.util.regex.Pattern, String --> org.apache.tapestry5.Renderable, String
> --> org.apache.tapestry5.SelectModel, String -->
> org.apache.tapestry5.corelib.LoopFormState, String -->
> org.apache.tapestry5.corelib.data.BlankOption, String -->
> org.apache.tapestry5.corelib.data.GridPagerPosition, String -->
> org.apache.tapestry5.corelib.data.InsertPosition, String -->
> org.apache.tapestry5.ioc.Resource, String -->
> org.apache.tapestry5.ioc.util.TimeInterval,
> au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService -->
> au.com.voicelogic.teleblast.business.calltrack.model.CallTrackService,
> boolean[] --> java.util.List, byte[] --> java.util.List, char[] -->
> java.util.List, double[] --> java.util.List, float[] --> java.util.List,
> int[] --> java.util.List, java.math.BigDecimal --> Double,
> java.util.Collection --> Boolean, java.util.Collection --> Object[],
> java.util.Collection --> org.apache.tapestry5.grid.GridDataSource,
> java.util.List --> org.apache.tapestry5.SelectModel, java.util.Map -->
>
> Note how it is trying to coerce from and to the same class and that if you
> read down further, there is an explicit coercion covering that class
> (CallTrackService)
>
> I have tried this with a grid component as well with the same result. What
> gets me is why a coercion is even happening - there is no form here. The tml
> extract is:
>
> <tr>
>         <t:loop source="callTrackServices" value="currentService"
> encoder="callTrackEncoder" volatile="true" formState="none">
>                <td><a href="#" t:context="${currentService.id}"
> t:type="PageLink"
> t:page="calltrack/ServicesEdit">${currentService.id}</a></td>
>                <td>${currentService.aliasPhoneNumber}</td>
>                <td>${currentService.privatePhoneNumber}</td>
>                <td>${currentService.terminatingPhoneNumber}</td>
>                <td>${currentService.recordingEnabled}</td>
>                <td>${currentService.voicemailEnabled}</td>
>                <td>${currentService.provisionTime}</td>
>                <td>
>                        <t:if test="${currentService.aliasPhoneNumber}"><a
> href="#" t:Type="PageLink" t:page="calltrack/ServicesRemove"
> t:context="${currentService.id}">Remove</a>
>                        <p:else><br /></p:else>
>                        </t:if>
>                </td>
>                </t:loop>
>        </tr>
>
> Have tried everything on this one, as per other posts out there, this was
> working on 5.0.18
>
> Any ideas anyone?
>
> Cheers,
>
> Ben
>
>
> ---------------------------------------------------------------------
> 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