The main points are:
- using an outputpanel
- <a:outputPanel id="studentPanel" ajaxRendered="true">
- using a c:foreach to iterate over the collection (do not use a:repeat or ui:repeat since they make multiple calls to the backing bean/called method)
- <c:forEach items="#{topStudents}" var="topStudent">
for the pagination use a:commandButton inside an a:form
<a:form >
<a:commandButton action="#{topStudentManager.getResultByPage(1)}" value="rre1" reRender="studentPanel">
<s:conversationPropagation type="join"></s:conversationPropagation>
</a:commandButton>
<a:commandButton action="#{topStudentManager.getResultByPage(2)}" value="rre2" reRender="studentPanel"/>
</a:form>
topStudents is a factory:
@Factory(value = "topStudents2")
public List<TopStudent> initializeTopStudent() {
//query DB and set topStudents
//set collection in context
//Contexts.getConversationContext().set("topStudents2", topStudents);
return topStudents;
}
// compute paging
public void getResultByPage(Integer page){
//set currentpage to page
//initiliase collection topStudents
//compute paging from collection
//set paging in context variable
//Contexts.getConversationContext().set("topStudentPages", topStudents);
}