For example, there is a goodsList in the Goods class that stores all the current products. The code of the page is:
js code
...
h:commandLink>
...
Goods The categories are as follows:
java code
publicclassGoods{
.. ..
privateDateModelgoodsList;
...
publicDataModelgetGoodsList(){
if(goodsList==null){
goodsList=newDataModel();
}
goodsList.setWrappedData (getRealGoodsList());//The database is accessed here through the Service layer or Dao layer
retrungoodsList;
}
publicStringselect(){
GoodsselectedGoods=(Goods)goodsList.getRowData();
setSelectedGoods(selectedGoods);
return "success";
}