Home  >  Article  >  Web Front-end  >  [JSF] Example code for using DataModel to handle table row events_javascript skills

[JSF] Example code for using DataModel to handle table row events_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:26:58954browse

For example, there is a goodsList in the Goods class that stores all the current products. The code of the page is:
js code

Copy code The code is as follows:



...








...



Goods The categories are as follows:

java code

Copy code The code is as follows:

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";
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn