// Backing Bean 建構子或 @PostConstruct
String page = (String) FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap().get("page");
String sort = ...;
List<Data> list = dao.findPage(page, sort, pageSize);
頁面連結:<h:outputLink value="list.jsf?page=3&sort=name">第 3 頁</h:outputLink>
<h:column>
<h:outputLink value="edit.jsf?id=#{row.id}">修改</h:outputLink>
</h:column>
// EditBean 建構子
public EditBean() {
String id = FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap().get("id");
this.entity = dao.findById(id);
}
優點:支援重新整理、後退、收藏、書籤。
commandButton action="#{bean.delete(row.id)}"無論何種功能,JSF 開發離不開: