aspose file tools*
The moose likes JSF and the fly likes Exception during addition of data from UI    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Exception during addition of data from UI    " Watch "Exception during addition of data from UI    " New topic
Author

Exception during addition of data from UI

Rashedul Hasan
Greenhorn

Joined: May 12, 2007
Posts: 1
I'm getting some exceptions while trying to save data to database from UI made with JSF components. The exceptions are as follows:

exception

javax.servlet.ServletException
javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)


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)
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)

And UI code is as follows:


<%@page session="false" contentType="text/html;charset=utf-8"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>
<html>
<head>
<title>Employee Registration</title>
<link rel="stylesheet" type="text/css" href="Css/Style.css"/>
</head>
<body>
<f:view>
<%@include file="Include.jsp"%>
<table border="0">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<!-- form starts -->
<h:form id="empfrm" enctype="multipart/form-data">
<table width="100%">
<tr>
<td>
<hutputText value="First Name :"/>
</td>
<td>
<h:inputText id="firstName" value="#{employee.firstName}" size="25" styleClass="textbox" required="true">
<f:validateLength maximum="50"/>
</h:inputText>
<h:message for="firstName" id="firstNameError" styleClass="error"> </h:message>
</td>
<td>
<hutputText value="Last Name :"/>
</td>
<td>
<h:inputText id="lastName" value="#{employee.lastName}" size="25" styleClass="textbox" required="true">
<f:validateLength maximum="50"/>
</h:inputText>
<h:message for="firstName" id="firstNameError" styleClass="error"> </h:message>
</td>
</tr>
<tr>
<td>
<hutputText value="Father's Name :"/>
</td>
<td>
<h:inputText id="father" value="#{employee.father}" size="25" styleClass="textbox" required="true">
<f:validateLength maximum="50"/>
</h:inputText>
<h:message for="father" id="fatherError" styleClass="error"> </h:message>
</td>
<td>
<hutputText value="Mother's Name :"/>
</td>
<td>
<h:inputText id="mother" value="#{employee.mother}" size="25" styleClass="textbox" required="true">
<f:validateLength maximum="50"/>
</h:inputText>
<h:message for="mother" id="motherError" styleClass="error"> </h:message>
</td>
</tr>
<tr>
<td>
<hutputText value="Religion :"/>
</td>
<td>
<h:selectOneMenu id="religion" value="#{employee.religion}" styleClass="selectOneMenu">
<f:selectItem itemValue="Islam" itemLabel="Islam"/>
<f:selectItem itemValue="Hindu" itemLabel="Hindu"/>
<f:selectItem itemValue="Christian" itemLabel="Christian"/>
<f:selectItem itemValue="Buddhist" itemLabel="Buddhist"/>
<f:selectItem itemValue="Other" itemLabel="Other"/>
</h:selectOneMenu>
</td>
</tr>
<tr>
<td>
<hutputText value="Department :"/>
</td>
<td>
<h:selectOneMenu id="departmentid" value="#{employee.deptOID}" required="true">
<f:selectItems value="#{department.deptNames}"/>
</h:selectOneMenu>
</td>
<td>
<hutputText value="Designation :"/>
</td>
<td>
<h:selectOneMenu id="designationid" value="#{employee.desigOID}" styleClass="selectOneMenu">
<f:selectItems value="#{designation.designations}"/>
</h:selectOneMenu>
</td>
</tr>
<tr>
<td>
<hutputText value="Country"/>
</td>
<td>
<t:selectOneCountry value="#{employee.country}"/>
</td>
<td>
<hutputText value="Blood Group :"/>
</td>
<td>
<h:selectOneMenu id="bloodgroupid" value="#{employee.bloodGroup}" styleClass="selectOneMenu">
<f:selectItem itemValue="apositive" itemLabel="A +ve"/>
<f:selectItem itemValue="anegative" itemLabel="A -ve"/>
<f:selectItem itemValue="abpositive" itemLabel="AB +ve"/>
<f:selectItem itemValue="abnegative" itemLabel="AB -ve"/>
<f:selectItem itemValue="bpositive" itemLabel="B +ve"/>
<f:selectItem itemValue="bnegative" itemLabel="B -ve"/>
<f:selectItem itemValue="opositive" itemLabel="O +ve"/>
<f:selectItem itemValue="onegative" itemLabel="O -ve"/>
</h:selectOneMenu>
</td>
</tr>
<tr>
<td>
<hutputText value="Gender :"/>
</td>
<td>
<h:selectOneRadio id="genderid" value="#{employee.sex}" styleClass="selectOneRadio">
<f:selectItem itemValue="M" itemLabel="Male"/>
<f:selectItem itemValue="F" itemLabel="Female"/>
</h:selectOneRadio>
<h:message for="genderid" id="gendererror" styleClass="error"> </h:message>
</td>
<td>
<hutputText value="Birth Date :"/>
</td>
<td>
<t:inputCalendar value="#{employee.dateofBirth}" renderAsPopup="true" renderPopupButtonAsImage="true"/>
<font color="#FF0000">*</font>
</td>
</tr>
<tr>
<td>
<hutputText value="Join Date :"/>
</td>
<td>
<t:inputCalendar value="#{employee.joinDate}" renderAsPopup="true" renderPopupButtonAsImage="true"/>
<font color="#FF0000">*</font>
</td>
<td>
<hutputText value="Privilege :"/>
</td>
<td>
<h:selectOneMenu id="privilegeid" value="#{employee.privilege}" styleClass="selectOneMenu">
<f:selectItem itemValue="admin" itemLabel="Admin"/>
<f:selectItem itemValue="user" itemLabel="User"/>
</h:selectOneMenu>
<h:message for="privilegeid" id="privilegeerror" styleClass="error"> </h:message>
</td>
</tr>
<tr>
<td>
<hutputText value="Login ID :"/>
</td>
<td>
<h:inputText id="loginid" value="#{employee.userName}" size="25" styleClass="textbox">
<f:validateLength maximum="30"/>
</h:inputText>
<h:message for="loginid" id="loginerror" styleClass="error"> </h:message>
</td>
<td>
<hutputText value="Password :"/>
</td>
<td>
<h:inputSecret id="passwordid" value="#{employee.password}" size="25" styleClass="textbox">
<f:validateLength maximum="30"/>
</h:inputSecret>
<h:message for="passwordid" id="passworderror" styleClass="error"> </h:message>
</td>
</tr>
<tr>
<td>
<h:commandButton id="save" value="Save" type="submit" action="#{employee.addEmployee}" styleClass="button"/>
</td>
</tr>
</table>
</h:form>
<!-- form ends-->
</td>
</tr>
</table>
</f:view>
</body>
</html>



Could anyone help me solve this?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception during addition of data from UI