This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes SelectItems + IllegalArgumentException + help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "SelectItems + IllegalArgumentException + help" Watch "SelectItems + IllegalArgumentException + help" New topic
Author

SelectItems + IllegalArgumentException + help

Mansingh Shitole
Greenhorn

Joined: Jun 10, 2008
Posts: 4
I am facing the problem, whenever I am trying to write selectItems tag in SelectOneMenu parent tag, it occurs. I am unable to find out why this illegalArgumentException is coming. Although value is coming in the list. But when Iam submitting the form it is giving exception. I am creating List of SelectItem object but dont know, why?
When I am using hard coded selecItem tag it is not giving any errors only while using selectItems...I searched a lot lot but never able to find out a satisfactory reason nor solution...I will provide my code..jst have a look at it..

My UIForm code
<ga:responseActions>
<id:listProjectLeaders target="#{plList}"/>
</ga:responseActions>
<h:selectOneMenu value="#{var['pl']}">
<f:selectItems value="#{plList}" />
</h:selectOneListbox>

I am getting data from database in dropdown list but not able to select..

My getMethod
public List<SelectItem> getProjectLeaders() {
List<SelectItem> projectLeaders = new ArrayList<SelectItem>();
SelectItem option = null;
String count = null;
Query query = session.createQuery(
"select usr.fullName from org.jbpm.identity.User as usr " +
"where usr.id in(select mbr.user.id from org.jbpm.identity.Membership as mbr " +
"where mbr.role = 'Project Leader')"
);
List lead = query.list();

System.out.println("================================");
System.out.println("Size of List = "+lead.size());
System.out.println("================================");

for(int i=0; i<lead.size(); i++)
{
pl = lead.get(i).toString();
count =String.valueOf(i);
option = new SelectItem(pl, pl);
projectLeaders.add(option);
}
System.out.println("================================");
System.out.println("================================");
System.out.println("PROJECTlEADERS = "+projectLeaders);
System.out.println("================================");
System.out.println("================================");

return projectLeaders;
}

Now what error, I am getting after clicking on submit button
type Exception report

exception

javax.servlet.ServletException
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root cause

java.lang.IllegalArgumentException
javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:166)
javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:49)
javax.faces.component.UISelectOne.matchValue(UISelectOne.java:165)
javax.faces.component.UISelectOne.validateValue(UISelectOne.java:137)
javax.faces.component.UIInput.validate(UIInput.java:868)
javax.faces.component.UIInput.executeValidate(UIInput.java:1071)
javax.faces.component.UIInput.processValidators(UIInput.java:663)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
javax.faces.component.UIForm.processValidators(UIForm.java:229)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

Please anybody guide me...

Thanking you
--Mansingh Shitole
Joe Matthew
Ranch Hand

Joined: Jun 10, 2008
Posts: 66
<h:selectOneMenu value="#{var['pl']}">
<f:selectItems value="#{plList}" />
</h:selectOneListbox>


The closing tag looks incorrect.

Also the select item value should be BB.Arraylist (containing SelectItems objects).

I have not worked with GA so I might be wrong.


Regards,<br />Joe<br /> <br />"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live."<br />--Martin Golding
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: SelectItems + IllegalArgumentException + help
 
Similar Threads
JSF Dropdown valueChangeEvent giving problems
Passing arrays from JSF to Javascript
Jsf DropDown menu "java.util.NoSuchElementException"
NoSuch Element Exception after running the Jmeter test!
h:selectOneMenu PROBLEM