I am trying to create a with a list to choose from. I am using JBoss 5.1 and Seam 2.2. My list should be dynamically populated from my DB, but for the moment I am trying to create a simple list. Which is not working!!
My html:
<h:selectOneMenu>
<f:selectItems value="#{browseQuarters.qList}"></f:sel开发者_如何学GoectItems>
</h:selectOneMenu>
The bean has a "qList" member:
@In(required=false)
private List<SelectItem> qList = new ArrayList<SelectItem>();
Which has getters and setters:
public List<SelectItem> getqList(){
qList.add(new SelectItem(1,"one"));
return qList;
}
public void setqList(List<SelectItem> qList) {
this.qList = qList;
}
However, when I try running the page, I get this exception: Property not found on type org.javassist.tmp.java.lang.Object_$$_javassist_seam_2
My project is generated using Jboss Tools, and I saw the other pages generated from the DB (to generate the entities) have a page.xml with the parameters defined..When creating this new form with New -> Seam form I only got a xhtml page and corresponding bean.
What's going wrong? I am of course a Seam/Java EE newbie, but have to do this ASAP :(
I think Seam/JSF will look for a method called getQList rather than the method you have, getqList. Try changing the names of the getter & setter.
Tip: Eclipse can generate compliant getters & setters for you.
精彩评论