tapestry5.0 下载本文

background-color: expression(( this.sectionRowIndex % 2 == 0) ? \}

.userName,.operation,.birthday,.role{ text-align: center; vertical-align: middle; }

16:55

? 浏览 (629) ? 评论 (0)

? 分类: Tapestry/Wicket/JSF2

?

2009-02-11 缩略显示

Tapestry5自定义组件

关键字: tapestry5 一、普通组件 1.java文件

package com.logcd.tapestry5.myapp.components;

import java.util.ArrayList; import java.util.List;

import org.apache.tapestry5.ComponentResources; import org.apache.tapestry5.annotations.Parameter; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.ioc.annotations.Inject;

public class NavBar { @Parameter(defaultPrefix = \ private String pages; @Inject private ComponentResources resources; @Property private Page _pageAttr; public List getPageNames() {

List pageList = new ArrayList(); String[] pageArr = pages.split(\ for(int i=0;i

(_pageAttr.name.equalsIgnoreCase(resources.getPageName())) return \ return null; } public class Page{ private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } private String url; } }

2.NavBar.tml

xmlns:t=\

page=\

3.页面使用

二、布局模板组件 1.java文件

package com.logcd.tapestry5.myapp.components;

import org.apache.tapestry5.annotations.IncludeStylesheet; //用 \前缀,如果存储在应用程序(webapp)的目录

//用\前缀,如果存储在应用程序的classpath路径下 @IncludeStylesheet(\public class Layout { }

2.tml文件

Tapestry 5 Demo Application

Tapestry 5 Demo

style=\首页]