Copy codeThe Code is as follows:
<? Xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns: t = "http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<Head>
<Meta name = "keywords" content = "$ {ks}">
<Meta name = "description" content = "$ {desc}">
<Title >$ {title} </title>
</Head>
<Body>
<T: body/>
</Body>
For example, on the previous template page, you want to dynamically change the title, keywords, and description in the template.
Add the following code in the java class on the template page:
Copy codeThe Code is as follows:
@ Parameter (defapreprefix = BindingConstans. LITERAL, name = "title", requred = true) // here I set the Parameter to mandatory \
@ Property (write = false) // mark attributes that cannot be written
Private String title;
Finally, in use:
Copy codeThe Code is as follows:
<Div t: type = "template" xmlns: t = "http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" title = "write your parameters here">
XXX
</Div>
After you reconfigure the server, you can see that the normal title attributes are displayed ....