Hello All! I have one command button for task add to cart, it means when items quantity instock is geater than 0 command button will display but if items quantity instock is 0 it doesn't display. How can i write one method render with command button for my upon requirement?
Edited
=================================================================================
i post my code attach with question following: i write one method in Session Bean select list of Quantity on hand in stock are zero following:
public List<Items> checkItemsInstock(){
Query query = em.createNamedQuery("Items.findByInstockgtZero");
query.setParameter("instockgtzero", 0);
return query.getResultList();
}
and Namequery is:
@NamedQuery(name = "Items.findByInstockgtZero", query = "SELECT i FROM Items i WHERE i.instock = :instockgtzero")
in JSF Managed Bean i wrote a method return list of items , and Quantity on hand are zero
public List<Items> getQuantityOnHand(){
return itemDAO.checkItemsInstock();
}
and in JSF Page i was rendered h:commandButton is:
<h:commandButton value="add to cart" style="font-size: x-small" action="#{catItemsListController.addtoCart(item)}" id="addcart" rendered="#{not empty catItemsListController.quantityOnHand}"/>
but it not work, all items have QOH is zero or not zero are display CommandButton
i need help ! Thank you