You would use the "prop:" binding prefix or an expansion. Please see
"Binding Expressions" and "Expansions":
http://tapestry.apache.org/tapestry5/tapestry-core/guide/parameters.html
http://tapestry.apache.org/tapestry5/tapestry-core/guide/templates.html
The prop binding language is very simple, so until there are other options
(like OGNL) you would have to use a Java method to build the string, or
in this case an expansion:
<t:layout title="prop:title" ...>
or
<t:layout title="Product Detail ${id}" ...>
Cheers,
Nick.
Jean-Philippe Steinmetz wrote:
Thanks for the response. I think for most cases going the
@Parameter(defaultPrefix="literal")
approach is probably the best one. However I am curious, if I do set the
defaultPrefix as literal how would I be able to use a variable in my
template? For instance if I wanted to do
<t:layout title="Product Detail 15" ...>
where 15 is the value of ${id} elsewhere in the template. Would that be
something like...
<t:layout title="'Product Detail' id" ...>
?
Thanks again.
Jean-Philippe
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Josh Canfield
Sent: Thursday, October 04, 2007 4:34 PM
To: Tapestry users
Subject: Re: [T5] Component Parameters
The problem with your first method is that you are trying to pass a
literal
but the default parameter type is property.
Change it to:
<t:layout title="'My Page'">
or
<t:layout title="literal:My Page">
or change the defaultPrefix in your Parameter to literal
@Parameter(defaultPrefix="literal")
The problem with the second method is that you are passing a Block
parameter
and it's getting coerced into a String. Usually I use this for passing
chunks of html into a component.
Josh
On 10/4/07, Jean-Philippe Steinmetz <[EMAIL PROTECTED]> wrote:
Hello All,
I have a layout component that I use to wrap all my pages with the same
HTML
header/footer. I would like to be able to set the page name with this
component. Ideally I would like it to look like:
<t:layout title="MyPage"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
Page content goes here
</t:layout>
In my Layout class I have added
@Parameter("")
private String _title;
public String getTitle()
{
return _title;
}
When I first set my template as described above I got an error because
the
name was the same as a class name and it was unable to convert the type.
So
then I changed it to
<t:layout
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<t:parameter name="title">MyPage</t:parameter>
Page content goes here
</t:layout>
This at least renders a page, but the title being displayed in the
browser
shows up as
[EMAIL PROTECTED]
instead of displaying MyPage. What am I doing wrong? Thanks in advance.
Jean-Philippe Steinmetz
--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]