/**
* 项目名称:TapestryStart
* 开发模式:Maven+Tapestry5.x+Tapestry-hibernate+Mysql
* 版本:1.0
* 编写:飞风
* 时间:2012-02-29
*/
package com.tapestry.app.pages.output;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.tapestry5.annotations.Property;
public class OutPut {
private Date outOne;
//经过get方法在页面上读出当前时间
public Date getOutOne(){
return new Date();
}
//经过output转换时间输出格式
public Format getDateFormat(){
return new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
}
//设置变量outTwo为可读,@Property属性有2个就是分别对应get与set方法的read与write,
//使用@Property好处是能够不用写get与set方法。
//注意:不是任何地方都有效,当get或set方法被调用的时候,这样写就无效了,由于找不到get或set方法。
@Property(read=true)
private String outTwo;
//经过 setupRender方法给outTwo赋值输出
void setupRender(){
outTwo = "经过 setupRender方法给outTwo赋值输出";
}
private String outThree;
//经过get方法读出outThree值,这里能够看到outputraw是会解析html节点的<br/>
public String getOutThree(){
return "hello<br/>tapestry";
}
}
<html t:type="layout" title="tapestryStart Index" t:sidebarTitle="Framework Version"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter">
${outOne}<br/><br/>
<t:output value="outOne" format="dateFormat"/><br/><br/>
${outTwo}<br/><br/>
${outThree}<br/><br/>
<t:outputraw value="${outThree}"/><br/><br/>
</html>
http://localhost/output/output