yojikさんのコメントから。
上のような画面で[別ページ]へ遷移するためのコードが、以下のようになる。
ページ
public class Index extends Page {private Database dbh = null;
public Table table = new Table();
public ActionButton other = new ActionButton(this, "onOtherClick");
public Index(Database dbh) {
this.dbh = dbh;table.setAttribute("class", "simple");
table.setPageSize(5);table.addColumn(new Column(Book.ISBN.getName().toLowerCase(), "ISBN"));
table.addColumn(new Column(Book.TITLE.getName().toLowerCase(), "タイトル"));
table.addColumn(new Column(Book.AUTHOR.getName().toLowerCase(), "著者"));other.setLabel("別のページへ");
}public void onRender() {
table.setRowList(Arrays.asList(Book.findAny(dbh, Book.ISBN.order_by())));
}public boolean onOtherClick() {
setForward(Foo.class);
return false;
}}
onOtherClick()でfalseを返さないと、[別ページへ]を押したときにonOtherClick()→onRender()と呼びだされて、不要なDB検索処理が行われる。
追記
setForward()したら、後の処理をすっ飛ばしてくれてもいいような気がする…