How to populate options of h:selectOneMenu from database?

前端 未结 5 1880
情话喂你
情话喂你 2020-11-21 05:03

I am creating a web application, where you have to read a list of objects / entities from a DB and populate it in a JSF . I am unable to

5条回答
  •  太阳男子
    2020-11-21 05:25

    View-Page

    
         
    
    

    Backing-Bean

       List names = new ArrayList();
    
       //-- Populate list from database
    
       names.add(new SelectItem(valueObject,"label"));
    
       //-- setter/getter accessor methods for list
    

    To display particular selected record, it must be one of the values in the list.

提交回复
热议问题