Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

illegalArgumentException

 
tun zaw
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
i have some problem with jsf h:selectOneMenu.I received the illegalArgumentException.I read java server faces in action 2005 published
by manning.

"If the EnumManager can�t find an ArtifactType instance for the int
value, an IllegalArgumentException will be thrown."

I don,t understand the EnumManager.
Here is my code copied from JavaBeat.
please help me.

selectOneMenu.jsp

<html>
<body>
<f:view>
<h:form id="select">
<h:panelGrid columns="1">
<h:column>
<hutputText value="Select a Name : "/>
<h:selectOneMenu value="#{selectOneBean.name}">
<f:selectItem itemValue="SteveJobs" value="SteveJobs"/>
<f:selectItem itemValue="Sergey Brin" value="Sergey Brin"/>
<f:selectItem itemValue="Larry Page" value="Larry Page"/>
<f:selectItem itemValue="Dell" value="Dell"/>
<f:selectItem itemValue="Mark Anderson" value="Mark Anderson"/>
</h:selectOneMenu>
</h:column>
<h:column>
<h:commandButton value="Submit" action="#{selectOneBean.submit}"/>
</h:column>
</h:panelGrid>
</h:form>
</f:view>
</body>
</html>


package net.javabeat.myfaces.menu;

public class SelectOneMenuBean {
private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
public String submit(){
return "selectOneMenu";
}
}


faces-config.xml



<faces-config>
<managed-bean>
<managed-bean-name>
selectOneBean
</managed-bean-name>
<managed-bean-class>
net.javabeat.myfaces.menu.SelectOneMenuBean
</managed-bean-class>
<managed-bean-scope>
request
</managed-bean-scope>
</managed-bean>
<navigation-rule>
<navigation-case>
<from-outcome>
selectOneMenu
</from-outcome>
<to-view-id>
/pages/menu/selectOneMenuResult.jsp
</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>


selectOneMenuResult.jsp






<html>
<body>
<f:view>
<hutputText value="Selected Name is : "/>
<hutputText value="#{selectOneBean.name}"/>
</f:view>
</body>
</htmlv
 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you use the same code? it should work fine. Are you using MyFaces.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic