Hi Josh,
I tried to folow following method, but not working:
my Layout.java like this:
public class Layout {
@Parameter
private Block _sidebarContent;
public Block getSidebarContent() {
return _sidebarContent;
}
public void setSidebarContent(Block sidebarContent) {
this._sidebarContent = sidebarContent;
}
@Parameter
private String _title;
public String getTitle() {
return _title;
}
public void setTitle(String title) {
this._title = title;
}
<cut some code here>
}
in my Somepage.html
<t:layout parameter="My Home" >
i noticed the setter in Layout.java will not be called, why? thanks.
A.C.
or you can add the title parameter to Layout and pass it from Somepage
Layout.java:
@Parameter // if you want to require a title, add (required=true)
private String title; // add getter/setter
Somepage.html
<t:layout title="'my layout'">
...
Josh Canfield-2 wrote:
>
> On 8/24/07, Angelo Chen <[EMAIL PROTECTED]> wrote:
>>
>> Hi Josh,
>>
>> This works, now if I have this in the Layout.html:
>>
>> <head>
>> <title>${title}</title>
>> </head>
>>
>> Layout.java also has a getTtitle to return 'base page';
>>
>> now how to replace this title with 'somepage' in the somepage.html? I add
>> a
>> getTitle in the Somepage.java, but it still picks up 'base page', any
>> solution to this?
>>
>
> There is no inheritance relationship between Somepage and Layout.
> Somepage contains a reference to the Layout object. You have options
> with how you are going to update the layout.
>
> You can inject the Layout object into Somepage and manipulate it by:
>
> @Component
> private Layout layout; // add getter/setter
> protected void beforeRender() {
> layout.setTitle(title);
> }
>
> or you can add the title parameter to Layout and pass it from Somepage
>
> Layout.java:
> @Parameter // if you want to require a title, add (required=true)
> private String title; // add getter/setter
>
> Somepage.html
> <t:layout title="'my layout'">
> ...
> </t:layout>
>
> Pick the one that makes the most sense for your application....
>
>
>
>> A.C.
>> Josh Canfield-2 wrote:
>> >
>> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd ">
>> >
>> > Could it be as silly as a space after the xsd?
>> >
>> > I have run the following successfully
>> >
>> > -----
>> >
>> <file:///C:/cygwin/workspace/svn/thedailytube/src/main/resources/com/thedailytube/ui/tapestry/pages/SomePage.html>/src/main/resources/com/thedailytube/ui/tapestry/pages/SomePage.html
>> > -------
>> >
>> > <t:layout
>> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>> > <t:parameter name="sidebarContent">
>> > SomePage Added Sidebar
>> > </t:parameter>
>> > This is the body content
>> > </t:layout>
>> >
>> > -----
>> > /src/main/resources/com/thedailytube/ui/tapestry/components/Layout.html
>> > -------
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/T5%3ATiles--tf4310807.html#a12309092
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>
> --
> --
> 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]
>
>
>
--
View this message in context:
http://www.nabble.com/T5%3ATiles--tf4310807.html#a12368634
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]