【发布时间】:2013-06-22 10:14:58
【问题描述】:
我正在尝试设置一个 selectOneMenu 列表,该列表由标签和类别 ID 中的类别名称填充,我正在这样做:
<h:selectOneMenu id="categorie" value="#{adminRealisationController.categorie }">
<c:forEach items="#{listeCats}" var="cat">
<f:selectItem itemLabel="#{cat.nom }" itemValue="#{cat.id }"/>
</c:forEach>
</h:selectOneMenu>
这个 listeCats 设置了一个 jsf bean,这是我从 db 中提取列表的方法
BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
CategoriesPL C = (CategoriesPL) beanFactory.getBean("categoriesPL");
setListeCats(C.findAll());
titre="";slug="";categorie.setId(2);description="";
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("listeCats", getListeCats());
return "nouveauView";
该属性在 faces xml 中设置为 Integer,当我尝试提交表单时出现此错误:
【问题讨论】:
标签: jsf selectonemenu