Hy Bryant,
Just a reminder that templates can access messages which are cataloged
in either YourApp.properties or SomeComponent.properties. So if you have
a layout component then you could simply have it access a message string
like so:
<title>${message:myapp.title}<title>
No if that doesn't suit, and of course it won't if you need a title to
depend on application state, then you need to use a component parameter.
Here's what your class might look like:
public class MyLayout {
@Parameter
private String title = "";
/**
* We'll use 'title' in the template, so we'll need a getter.
* @return the title
*/
public String getTitle() {
return title;
}
And layout your (minimal) MyLayout.html template:
<html>
<head>
<title>${title}</title>
</head>
<body>
<t:body/>
</body>
</html>
Now when you use your layout component you simply have to pass in the
title. From a template this would be:
<div>
<t:mylayout title="pageTitle"/>
</div>
Here "pageTitle" would have to be a property of the page using the
component. Remember that the default binding prefix for component
parameters is "prop:", which means Tapestry will try to access a getter
named "getPageTitle" on your page.
You could also probably initialize the component title from your page
class by declaring the component in the page and then setting it
programatically.
Hope that helps.
chris
Bryant Castaneda wrote:
Hi,
I am new to Tapestry and to version 5. I am trying to use a page to
pass in the parameter string to my layout component. Example, passing
in a title from my page to my layout component. Also, trying to do
this without using injection. Let me know if this is feasible.
Thanks,
- Bryant
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]