Friday 15 August 2014

jsf - selectOneMenu HTTP Status 500 - Don't know how to iterate over supplied "items" -


I am trying to set a selectOneMenu list filled with Categorie name in the amp; In classification ID value, I am doing this like this:

  & lt; H: selectOneMenu id = "categorie" value = "# {adminRealisationController.categorie}" & gt; & Lt; C: forEach item = "# {listeCats}" var = "cat" & gt; & Lt; F: select item item label = "# {cat.nom}" item value = "# {cat.id}" /> & Lt; / C: foreach & gt; & Lt; / H: selectOneMenu & gt;   

This listeCats is a JSF bean set here. What I am doing to remove the list from db

  BeanFactory beanFactory = New XMLBeanFactory (New ClassPathResource ( "ApplicationContext.xml")); CategoriesPLC = (CategoriesPL) BeanFactorGetBean ("CategoriesPil"); SetListeCats (C.findAll ()); Titre = ""; Slug = ""; Categorie.setId (2); Description = ""; FacesContext.getCurrentInstance (). GetExternalContext (). GetRequestMap () Put ("listeCats", getListeCats ()); Return "Nuweview";   

The property is set as an integral face in xml and I got this error when I try to submit the form:

This is the reason that f: selectItems is present, you should change it

  & lt ; C: forEach items = "# {ListeCats}" var = "cat" & gt; & Lt; F: select item item label = "# {cat.nom}" item value = "# {cat.id}" /> & Lt; / C: foreach & gt;   

by this (when JSF 2.0 is used)

     

Or through (when using JSF 1.X)

  & lt; F: selectItems value = "# {listeCats}" />   

Later, you can call list & lt; SelectItem & gt; :

  public list   

Note: This is just an example, it is not efficient at all. The only thing to remember is that you need to change your object list to SelectItem . Also, value = "# {adminRealisationController.categorie}" will not get a string and your object will not be , so you can change it

More info:



No comments:

Post a Comment