Page的java文件要实现PageValidateListener接口,
完成pageValidate(PageEvent event)方法
注意public void pageValidate(PageEvent event) {
if (!getUserExists()) {
Login login = getLoginPage();
login.setNextPage("Confirm");
throw new PageRedirectException(login);
}
}
注意这里要用PageRedirectException方法,因为As the rendering
has begun, calling activate() will have no
effect. To interrupt the rendering of the
current page and render another page,
you need to throw a
PageRedirectException.
这里是服务器内部跳转
The URL displayed in the
browser will not be changed
because the redirection
happens inside Tapestry
only.