public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { // coerce the value to an int try { System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+value.toString()); StringTokenizer st = new StringTokenizer(value.toString(),"."); String[] userDate = new String[3]; for (int i = 0 ; i < 4 ; i++){ userDate[i] = st.nextToken(); } System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+userDate.length); gc.set(Integer.parseInt(userDate[0]), Integer.parseInt(userDate[1]), Integer.parseInt(userDate[2])); } catch (NumberFormatException e) { FacesMessage msg = new FacesMessage("Your date may be incorrect."); throw new ValidatorException(msg); } }