Package javax.faces.validator

Examples of javax.faces.validator.ValidatorException


      {
        return;
      }
      if (!GenericValidator.isEmail(value.toString())) {
        Object[] args = {value.toString()};
        throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,EMAIL_MESSAGE_ID, args));
       
      }

  }
View Full Code Here


      throw new FacesException("Unable to find component '" + _for + "' (calling findComponent on component '" + uiComponent.getId() + "')");

    Object[] args = {value.toString(),(foreignComp.getValue()==null) ? foreignComp.getId():foreignComp.getValue().toString()};

    if(foreignComp.getValue()==null || !foreignComp.getValue().toString().equals(value.toString())  )
      throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,EQUAL_MESSAGE_ID, args));
   
  }
View Full Code Here

    {
  FacesMessage message = new FacesMessage();
  message.setSeverity(severity);
  message.setSummary(summary);
  message.setDetail(detail);
  return new ValidatorException(message);
    }
View Full Code Here

        catch (EvaluationException ee)
        {
          Throwable cause = ee.getCause();
          if (cause instanceof ValidatorException)
          {
            ValidatorException ve = (ValidatorException) cause;

            // If the validator throws an exception, we're
            // invalid, and we need to add a message
            setValid(false);
            FacesMessage message = ve.getFacesMessage();
            if (message != null)
            {
              message.setSeverity(FacesMessage.SEVERITY_ERROR);
              message = _wrapMessage(message);
              context.addMessage(getClientId(context), message);
View Full Code Here

            try
            {
                validator = _binding.getValue(elContext);
            } catch (Exception e)
            {
                throw new ValidatorException(new FacesMessage("Error while creating the Validator"), e);
            }
            if (validator instanceof Validator)
            {
                return (Validator) validator;
            }
        }
        Application application = facesContext.getApplication();
        Validator validator = null;
        try
        {
            // first check if an ValidatorId was set by a method
            if (null != _validatorIdString)
            {
                validator = application.createValidator(_validatorIdString);
            } else if (null != _validatorId)
            {
                String validatorId = (String) _validatorId.getValue(elContext);
                validator = application.createValidator(validatorId);
            }
        } catch (Exception e)
        {
            throw new ValidatorException(new FacesMessage("Error while creating the Validator"), e);
        }

        if (null != validator)
        {
            if (null != _binding)
            {
                _binding.setValue(elContext, validator);
            }
            return validator;
        }
        throw new ValidatorException(new FacesMessage("validatorId and/or binding must be specified"));
    }
View Full Code Here

            {
                _tree.setNodeId(nodeId);
            }
            catch (Exception e)
            {
                throw new ValidatorException(message, e);
            }

            if (_tree.getNode().isLeaf())
            {
                message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                           "Invalid node path (cannot expand a leaf): " + nodeId,
                                           "Invalid node path (cannot expand a leaf): " + nodeId);
                throw new ValidatorException(message);
            }
        }
    }
View Full Code Here

    public void validateCar(FacesContext context, UIComponent component, Object value) throws ValidatorException
    {
        if (value instanceof String && value.equals("c6"))
        {
            throw new ValidatorException(new FacesMessage("Are you kidding?", "You cannot buy a James Blond car!"));
        }
    }
View Full Code Here

      int maxBytes = getMaximum();
      try
      {
        byte[] bytes = theValue.getBytes(getEncoding());
        if (bytes.length > maxBytes)
          throw new ValidatorException(
            getLengthValidationFailureMessage(context, component, theValue));

      }
      catch (UnsupportedEncodingException uee)
      {
View Full Code Here

        try {
          new BigInteger((String) object, 16);
        } catch (NumberFormatException e) {
          FacesMessage message = new FacesMessage();
          message.setSummary(EjbcaJSFHelper.getBean().getEjbcaWebBean().getText("HEXREQUIRED"));
          throw new ValidatorException(message);
        }
      }
    }
  }
View Full Code Here

      log.debug("Validating component " + uIComponent.getClientId(facesContext) + " with value \"" + textFieldValue + "\"");
    }
    if (StringTools.hasSqlStripChars(textFieldValue)) {
      FacesMessage message = new FacesMessage();
      message.setSummary(EjbcaJSFHelper.getBean().getEjbcaWebBean().getText("INVALIDCHARS"));
      throw new ValidatorException(message);
    }
  }
View Full Code Here

TOP

Related Classes of javax.faces.validator.ValidatorException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.