Hai every one
i need to generate the dynamic page with dataTabl. I need to fetch the relevant data depends in the user subcategory selection. If the user click the s:link on my home page, I will get the subcategory id of that subcategory, Then I fetch the data found in subcategory, and then I display the data in the dataTable.
This is my home page code
s:link view="/TableList.xhtml" value=�cell phone� action="#{search.selectRequest}"> <f:param name="subid" value="2"/> </s:link>
<h:form> <rich:dataTable value="#{productList}" var="Product"> <f:facet name="header"> <rich:columnGroup> <h:column> <h:outputText value="SubcategoryName" /> </h:column> <h:column> <h:outputText value="Product Name" /> </h:column> </f:facet> </rich:columnGroup> <h:column> <h:outputText value="#{Product.subcat}" /> </h:column> <h:column> <h:outputText value="#{Product.name}" /> </h:column> </rich:dataTable> </h:form>
@Stateful @Name("search") public class ProductsAction implements ProductsLocal,Serializable { @RequestParameter String subid; @Out(required=false) List<TblProducts> productList; @Begin(join=true) public String selectRequest() { productList =em.createQuery("select t from TblProducts t where t.subcat="+ subid).getResultList(); } }