Saturday, October 25, 2008

Page LifeCycle Methods in Tapestry5

当组件或者页面中有方法用@PageLoaded这个Mathod Annotation声明过,则此方法只会在页面第一次完全加载时调用一次,以后页面直接从PagePool中获取的话,将不会再调用这个方法,但页面生命周期中的另外二个方法会继续被调用(pageAttached/pageDetached),页面生命周期方法必须为无参方法并且只能返回void值。

@PageLoaded
public void pageLoaded() {
System.out.println("page be loaded and run only once.");
}

Reference:http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/annotations/PageLoaded
http://tapestry.apache.org/tapestry5/guide/lifecycle.html

No comments :