I am trying to use a PrimeFacesOneMenu selector for my project. Its functionality is as follows: I want to register an object of type Discipline in the DB, hence I need the selector to include an object of type Teacher in the discipline, not to include the data of the object type Teacher. I can not retrieve the name of all the teachers to show in the selector when I make the choice. Any tips ???
<h:outputLabel value="Selecionar um Professor" />
<p:selectOneMenu id="selectedProf" value="#{selectedProf.recuperarTodosProfessores}" label="Select" effect="fold" editable="true" panelStyle="width:250px">
<f:selectItem itemLabel="Selecionar" itemValue="" />
<f:selectItems value="#{curs.professor}" />
</p:selectOneMenu>
<p:commandLink value="Adicionar" update="display1" />
<p:outputPanel id="display1" style="width:250px;padding-left: 5px;margin-top: 10px">
<p:dataList value="#{discip.professor}" var="curso">#{professor}</p:dataList>
</p:outputPanel>
In this case I have to retrieve the list of objects of type Teacher and show in the selector, appearing only the name of the Teacher to select and add in the teacher attribute of the Discipline class.