This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

SelectItems + IllegalArgumentException + help  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!