Processing of java tapestry5 layout parameters

  • 2020-05-07 20:14:05
  • OfStack


<?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, in the previous template page, you want to change title, keywords and description dynamically.
Add the following code to the java class on the template page:

@Parameter(defaultPrefix = BindingConstans.LITERAL,name = "title",requred=true)// I'm going to set it as the argument here \ 
@Property(write=false)// Annotate unwritable properties  
private String title;

Finally, when used:

<div t:type=" template " xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" title=" Write your parameters here "> 
XXX 
</div> 

After rearranging the server, it has been found that normal title properties can be displayed...

Related articles: