Howard Lewis Ship wrote:
>  Please send your Question and Answer to this
> list.  
>
Q: What is a convenient way to create a common design for all pages of an
application?

A: (how I do it) Create a component called "Layout" for your application. 
If the package name of the application is org.example.myapp you need these
files:
src/main/java/org/example/myapp/components/Layout.java
 package net.genealogy.gedbas.classic.components;
 import org.apache.tapestry.Asset;
 import org.apache.tapestry.annotations.Parameter;
 import org.apache.tapestry.annotations.Path;
 import org.apache.tapestry.ioc.annotations.Inject;
 public class Layout {
    @Inject
    @Path("context:/style.css")
    private Asset style;
    @Parameter
    private String title;
    public String getTitle() { return title; }
    public Asset getStyle() { return style; }
 }

src/min/resources/org/example/myapp/components/Layout.tml
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
<head><title>${title}</title>
<link rel="stylesheet" href="${style}" type="text/css" media="all" />
</head>
<body>
<h1>${title}</h1>
<t:body/>
</body></html>

The CSS goes to src/main/webapp/style.css

All pages of the application look like:
<t:layout title="message:page.name"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
 content
</t:layout>


Jesper

-- 
Jesper Zedlitz                   Dept. for Computer Science, CAU of Kiel
Room 1108                        Communication Systems Research Group
                                 Phone:    +49-(0)431-880-7279
Christian-Albrechts-Platz 4      Fax:      +49-(0)431-880-7615
24098 Kiel - Germany             [EMAIL PROTECTED]


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

Reply via email to