I like to use the Seam Manager Component pattern in Seam 2.0.0.GA and provide a list using @Unwrap:
@Name("holidayRequestByApproverList") public class HolidayRequestByApproverList { @Unwrap public List<HolidayRequest> getHolidayRequestByApproverList() { ... return myList; } }
<rich:dataTable id="dtHolidayRequestList" var="holidayRequest" value="#{holidayRequestByApproverList}" rendered="#{not empty holidayRequestByApproverList}"> ... <h:column> <f:facet name="header"> <s:span styleClass="columnHeader">Nr</s:span> </f:facet> #{holidayRequest.id} </h:column> <h:column> <f:facet name="header">Action</f:facet> <s:button value="Reject" action="#{holidayApprovalAction.reject(holidayRequest)}"> </s:button> </h:column>
@Stateful @Name("holidayApprovalAction") @Scope(ScopeType.SESSION) public class HolidayApprovalActionImpl implements HolidayApprovalAction { private static final long serialVersionUID = 6068522266849679060L; @PersistenceContext(type = PersistenceContextType.EXTENDED) EntityManager entityManager; @Begin public void reject(HolidayRequest hr) { ... entityManager.persist(hr); }
Why not use page parameters.