You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Gunnar Eketrapp <gu...@gmail.com> on 2010/11/08 12:12:23 UTC
Passing an asset as parameter
I have a layout component to which I would like to pass an asset (a banner
image) as a parameter.
But I get this error ...
Could not find a coercion from type java.lang.String to type
org.apache.tapestry5.Asset.
Layout.java
...
@Parameter(required = false)
private Asset banner;
...
In Index.tml I have tried both
<html t:type="layout" t:banner="${banner}"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns:p="tapestry:parameter">
where banner was an asset property in the Index.java
and
<html t:type="layout" t:banner="${context:images/banner_index.jpg}"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns:p="tapestry:parameter">
but same error on both attempt.
TIA
Re: Passing an asset as parameter
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 08 Nov 2010 09:12:23 -0200, Gunnar Eketrapp
<gu...@gmail.com> wrote:
> I have a layout component to which I would like to pass an asset (a
> banner image) as a parameter.
>
> But I get this error ...
>
> Could not find a coercion from type java.lang.String to type
> org.apache.tapestry5.Asset.
>
> Layout.java
> ...
> @Parameter(required = false)
> private Asset banner;
> ...
> <html t:type="layout" t:banner="${context:images/banner_index.jpg}"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> xmlns:p="tapestry:parameter">
Try t:banner="context:images/banner_index.jpg". Using ${} forces the
coercion of the value to String. By the way, don't use expansions when
passing parameters.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org