selectOneMenu simple question...

G

gbattine

Hi guys,
i'm a question for you.I'm using for the first time a selectonemenu tag
in my JSF application and i've this error

javax.servlet.ServletException: javax.servlet.jsp.JspException: Value
binding '#{user.teams}'of UISelectItems with component-path
{Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId:
/Login.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id1][Class:
javax.faces.component.html.HtmlPanelGrid,Id: _id2][Class:
javax.faces.component.html.HtmlPanelGrid,Id: _id4][Class:
javax.faces.component.html.HtmlSelectOneMenu,Id: selectTeam][Class:
javax.faces.component.UISelectItems,Id: _id19]} does not reference an
Object of type SelectItem, SelectItem[], Collection or Map but of type
: null
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.Login_jsp._jspService(Login_jsp.java:114)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:670)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:637)
org.apache.jsp.index_jsp._jspService(index_jsp.java:43)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.lang.IllegalArgumentException: Value binding '#{user.teams}'of
UISelectItems with component-path {Component-Path : [Class:
javax.faces.component.UIViewRoot,ViewId: /Login.jsp][Class:
javax.faces.component.html.HtmlForm,Id: _id1][Class:
javax.faces.component.html.HtmlPanelGrid,Id: _id2][Class:
javax.faces.component.html.HtmlPanelGrid,Id: _id4][Class:
javax.faces.component.html.HtmlSelectOneMenu,Id: selectTeam][Class:
javax.faces.component.UISelectItems,Id: _id19]} does not reference an
Object of type SelectItem, SelectItem[], Collection or Map but of type
: null
org.apache.myfaces.shared_impl.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:141)
org.apache.myfaces.shared_impl.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:477)
org.apache.myfaces.shared_impl.renderkit.RendererUtils.getSelectItemList(RendererUtils.java:453)
org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:277)
org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:251)
org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:54)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:442)
org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:216)
org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:98)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:442)
org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:216)
org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:98)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:623)
javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:546)
com.sun.faces.taglib.html_basic.PanelGridTag.doEndTag(PanelGridTag.java:460)
org.apache.jsp.Login_jsp._jspx_meth_h_panelGrid_0(Login_jsp.java:249)
org.apache.jsp.Login_jsp._jspx_meth_h_form_0(Login_jsp.java:210)
org.apache.jsp.Login_jsp._jspx_meth_f_view_0(Login_jsp.java:162)
org.apache.jsp.Login_jsp._jspService(Login_jsp.java:105)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:670)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:637)
org.apache.jsp.index_jsp._jspService(index_jsp.java:43)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


In my Login.jsp i have this selectoneMenu tag inside a form

<h:selectOneMenu id="selectTeam"
value="#{authenticationBean.teamName}">
<f:selectItems
value="#{user.teams}" />
</h:selectOneMenu>

where authenticationBean authenticates login and user.teams cames from
bean User where

private List<SelectItem> teams;
public List<SelectItem> getTeams() {
return teams;
}

public void setTeams(List<SelectItem> teams) {
this.teams = teams;
}
public List<SelectItem> teamList() throws SQLException {
try{
DataSource dataSource=Singleton.getInstance().getDataSource();
Connection conn=dataSource.getConnection();
Statement stmt = conn.createStatement();
ResultSet rst = stmt
.executeQuery("select * from researchteam order by
teamname");
List<SelectItem> teams = new ArrayList();
while (rst.next())
teams.add(new
SelectItem(rst.getString("teamname"),rst.getString("teamname")));
rst.close();
conn.close();
}
catch(Exception e){};
return teams;
}

Can you help me to find the error?
Thanks...
 
C

cp

"java.lang.IllegalArgumentException" should get you started. You are passing
a method an illegal argument.
gbattine said:
Hi guys,
i'm a question for you.I'm using for the first time a selectonemenu tag
in my JSF application and i've this error

javax.servlet.ServletException: javax.servlet.jsp.JspException: Value
binding '#{user.teams}'of UISelectItems with component-path
{Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId:
/Login.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id1][Class:
javax.faces.component.html.HtmlPanelGrid,Id: _id2][Class:
javax.faces.component.html.HtmlPanelGrid,Id: _id4][Class:
javax.faces.component.html.HtmlSelectOneMenu,Id: selectTeam][Class:
javax.faces.component.UISelectItems,Id: _id19]} does not reference an
Object of type SelectItem, SelectItem[], Collection or Map but of type
: null
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextI
mpl.java:821)org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:758)
org.apache.jsp.Login_jsp._jspService(Login_jsp.java:114)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
24)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:
322)com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:13
0)com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java
:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:670
)org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:637)
org.apache.jsp.index_jsp._jspService(index_jsp.java:43)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
24)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.lang.IllegalArgumentException: Value binding '#{user.teams}'of
UISelectItems with component-path {Component-Path : [Class:
javax.faces.component.UIViewRoot,ViewId: /Login.jsp][Class:
javax.faces.component.html.HtmlForm,Id: _id1][Class:
javax.faces.component.html.HtmlPanelGrid,Id: _id2][Class:
javax.faces.component.html.HtmlPanelGrid,Id: _id4][Class:
javax.faces.component.html.HtmlSelectOneMenu,Id: selectTeam][Class:
javax.faces.component.UISelectItems,Id: _id19]} does not reference an
Object of type SelectItem, SelectItem[], Collection or Map but of type
: null
org.apache.myfaces.shared_impl.util.SelectItemsIterator.hasNext(SelectItemsI
terator.java:141)org.apache.myfaces.shared_impl.renderkit.RendererUtils.internalGetSelectItem
List(RendererUtils.java:477)org.apache.myfaces.shared_impl.renderkit.RendererUtils.getSelectItemList(Ren
dererUtils.java:453)org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.internalRend
erSelect(HtmlRendererUtils.java:277)org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderMenu(H
tmlRendererUtils.java:251)org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.encodeEnd
(HtmlMenuRendererBase.java:54)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererU
tils.java:442)org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChi
ldren(HtmlGridRendererBase.java:216)org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd
(HtmlGridRendererBase.java:98)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererU
tils.java:442)org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChi
ldren(HtmlGridRendererBase.java:216)org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd
(HtmlGridRendererBase.java:98)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:623)
javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:546)
com.sun.faces.taglib.html_basic.PanelGridTag.doEndTag(PanelGridTag.java:460)
org.apache.jsp.Login_jsp._jspx_meth_h_panelGrid_0(Login_jsp.java:249)
org.apache.jsp.Login_jsp._jspx_meth_h_form_0(Login_jsp.java:210)
org.apache.jsp.Login_jsp._jspx_meth_f_view_0(Login_jsp.java:162)
org.apache.jsp.Login_jsp._jspService(Login_jsp.java:105)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
24)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:
322)com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:13
0)com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java
:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:670
)org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:637)
org.apache.jsp.index_jsp._jspService(index_jsp.java:43)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
24)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


In my Login.jsp i have this selectoneMenu tag inside a form

<h:selectOneMenu id="selectTeam"
value="#{authenticationBean.teamName}">
<f:selectItems
value="#{user.teams}" />
</h:selectOneMenu>

where authenticationBean authenticates login and user.teams cames from
bean User where

private List<SelectItem> teams;
public List<SelectItem> getTeams() {
return teams;
}

public void setTeams(List<SelectItem> teams) {
this.teams = teams;
}
public List<SelectItem> teamList() throws SQLException {
try{
DataSource dataSource=Singleton.getInstance().getDataSource();
Connection conn=dataSource.getConnection();
Statement stmt = conn.createStatement();
ResultSet rst = stmt
.executeQuery("select * from researchteam order by
teamname");
List<SelectItem> teams = new ArrayList();
while (rst.next())
teams.add(new
SelectItem(rst.getString("teamname"),rst.getString("teamname")));
rst.close();
conn.close();
}
catch(Exception e){};
return teams;
}

Can you help me to find the error?
Thanks...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,965
Messages
2,570,148
Members
46,710
Latest member
FredricRen

Latest Threads

Top