Win a copy of Learning Regular Expressions this week in the General Computing 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

What's the problem?Can anybody help me?  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my jsf page,I had two selectOneMenu,everyone of the selectItem which had something assinged in the first selectOneMenu. when I chose from the first one,than something show in the second one.so I can chose from the second one.
But when i run it,it show
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException
javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)


root cause

java.lang.IllegalArgumentException
javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:124)
javax.faces.component.UISelectOne.matchValue(UISelectOne.java:141)
javax.faces.component.UISelectOne.validateValue(UISelectOne.java:114)
javax.faces.component.UIInput.validate(UIInput.java:634)
javax.faces.component.UIInput.executeValidate(UIInput.java:838)
javax.faces.component.UIInput.processValidators(UIInput.java:412)
javax.faces.component.UIForm.processValidators(UIForm.java:170)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:904)
javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:342)
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:78)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)



and my code is :
<h:selectOneMenu value="#{user.selection}" onchange="submit()" valueChangeListener="#{user.ChangeItem}"styleClass="inputtext_css">
<f:selectItem itemValue="1" itemLabel="test1"/>
<f:selectItem itemValue="2" itemLabel="test2"/>
</h:selectOneMenu>
<h:selectOneMenu value="#{user.userName}">
<f:selectItems value="#{user.condiments}"/>
</h:selectOneMenu>

the bean 's code is :

private String userName;
private String password;
private String selection;
private Map condiments = new HashMap();

public void ChangeItem(ValueChangeEvent event){
if(!condiments.isEmpty()){
condiments.clear();
}
condiments.put("test", new Integer(1));
condiments.put("hq",new Integer(2));
}
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess the problem is in this code



I think you should have List<SelectItem> in the value attribute of <f:selectItems> tag instead of a HashMap as user.condiments is a HashMap.
[ December 12, 2006: Message edited by: Ali Gohar ]
 
huang qiang
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you !
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!