Exception with SelectManyCheckbox
yohann49 Aug 24, 2007 3:18 AMHello !!!!!!
I have a list of report(already persist in database), and I want to display them on a jsf page with selectManyCheckbox.But when I want to acces to the page I have this exception :
Exception during request processing: javax.servlet.ServletException: Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectMany(j_id28). Found null.
My jsf page :
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> <body> <ui:composition template="templates/client.xhtml"> <ui:define name="servicesclients"> <h:form> <h:selectManyCheckbox value="#{reports}"> <f:selectItems itemValue="#{reporte}" var="rep" itemLabel="#{rep.descReport}"/> </h:selectManyCheckbox> </h:form> </ui:define> </ui:composition> </body> </html>
My entity :
@Entity @Name("Report") public class Report implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long reportId; private String repName; private String descReport; /** *Creates the foreign key in relation to the category table */ @OneToMany (mappedBy = "reportId") private List<Category> categories; /** *Creates the foreign key in relation to the ContactReportBinder table */ @ManyToOne @JoinColumn (name = "binderId_fk") private ContactReportBinder binderId; /** Creates a new instance of Report */ public Report() { } Then Getters and setters
and My Bean :
@Stateless @Name("ReportManager") @Scope(CONVERSATION) public class ReportManager implements com.pingwy.web.front.ReportManagerLocal, Serializable { /** * Creates a new instance of ReportManager */ @In private EntityManager em; @DataModel @Out(required = false) private List<Report> reports; @DataModelSelection @Out(required = false) @In(required = false) SelectItem reporte; @Factory("reports") public List<Report> getReports() { return em.createQuery("select r from Report r").getResultList(); } public void setReports(List<Report> reports) { this.reports = reports; } public SelectItem getReporte() { return reporte; }
Thanks for your help in advance.
Yohann