Hi Josh,

if I use the approach quoted below, I got an error like this from runtime
console, and the title was not set:

[ERROR] Login Embedded component(s) layout are defined within component
class org.sample.t5.pages.Login, but are not present in the component
template.

What I'm doing wrong here? my code is:


    @Component
    private Layout layout; // add getter/setter
    protected void beforeRender() {
    layout.setTitle("test");
    }

Thanks,

A.C.

<
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);
}
>



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....
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3ATiles--tf4310807.html#a12382045
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to