こんにちは: 私はjsfプロジェクトを開発しています。私はselectOneMenuを動作させることに飽き飽きしています。jsf selectonemenuエラー
<h:selectOneMenu value="#{employeeEditBean.employeeBean}">
<f:selectItems value="#{employeeEditBean.branchList}" />
</h:selectOneMenu>
public class EmployeeEditHandler
{
private String paramEmPK;
private Employee employeeBean;
private List<Branch> branchList;
private int branchFK;
public EmployeeEditHandler()
{
paramEmPK = FacesContext.getCurrentInstance().getExternalContext()
.getRequestParameterMap().get("emPK");
int emPK = Integer.parseInt(paramEmPK);
branchList = new ArrayList<Branch>();
employeeBean = new Employee();
FacesContext context = FacesContext.getCurrentInstance();
try
{
employeeBean = DaoFactory.getEmployeeDao().lookupEmployeeByPK(emPK);
branchFK = employeeBean.getBranchFK();
branchList = DaoFactory.getBranchDao().findAllBranch();
}
catch (Exception e) {
FacesMessage msg = new FacesMessage(e.getMessage());
msg.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage("employeeEditForm", msg);
}
}
The error is:javax.servlet.ServletException: Argument Error: An option for component j_id8 was not an instance of javax.faces.model.SelectItem. Type found: java.util.ArrayList. javax.faces.webapp.FacesServlet.service(FacesServlet.java:277) org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)