Processing of layout parameters in Java Tapestry5

Time:2021-6-12
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, when using the template page above, you want to change the title, keywords and description dynamically.
Add the following code in the Java class of the template page:

Copy codeThe code is as follows:
@Parameter (defaultprefix = bindingconstants.literal, name = “title”, requred = true) / / here I set it as a parameter, and it must be\
@Property (write = false) / / mark the non writable property
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 rearranging the server, it has been found that the normal Title properties can be displayed….

Recommended Today

Programming Xiaobai must understand the network principle

How is the network composed? Why can we easily surf the Internet now?Whether you are a computer major or not, you may always have such questions in your heart!And today we will solve this matter and tell you the real answer! Basic composition of network First, let’s look at this sentence Connect all computers together […]