Package net.sourceforge.stripes.validation

Examples of net.sourceforge.stripes.validation.LocalizableError


  public void validatePassword(ValidationErrors ignore) {
    final String sPassw1 = getParam("user.password");
    final String sPassw2 = getParam("password2");
    if (sPassw2!=null) {
      if (sPassw2.length()<6)
        addError(new LocalizableError("com.zesped.action.SaveUser.password.valueTooShort"));
      if (sPassw2.length()>20)
        addError(new LocalizableError("com.zesped.action.SaveUser.password.valueTooLong"));
      if (!sPassw2.equals(sPassw1))
        addError(new LocalizableError("com.zesped.action.SaveUser.passwMismatch"));
    }
  } 
View Full Code Here


     
          sAmount = sAmount.replace(',','.');
          try {
            oRetVal = new BigDecimal(sAmount);
          } catch (NumberFormatException nfe) {
            conversionErrors.add(new LocalizableError("converter.bigDecimal.numberFormatException", sAmount));
          }
        }
      }
      return oRetVal;
  }
View Full Code Here

    public Resolution login() {
        PersonManager pm = new PersonManager();
        Person person = pm.getPerson(this.username);

        if (person == null) {
            ValidationError error = new LocalizableError("usernameDoesNotExist");
            getContext().getValidationErrors().add("username", error);
            return getContext().getSourcePageResolution();
        }
        else if (!person.getPassword().equals(password)) {
            ValidationError error = new LocalizableError("incorrectPassword");
            getContext().getValidationErrors().add("password", error);
            return getContext().getSourcePageResolution();
        }
        else {
            getContext().setUser(person);
View Full Code Here

     * username entered is not already taken in the system.
     */
    @ValidationMethod
    public void validate(ValidationErrors errors) {
        if ( new PersonManager().getPerson(this.user.getUsername()) != null ) {
            errors.add("user.username", new LocalizableError("usernameTaken"));
        }
    }
View Full Code Here

        // Add validation error with parameters for max post size and actual posted size (KB)
        DecimalFormat format = new DecimalFormat("0.00");
        double max = (double) exception.getMaximum() / 1024;
        double posted = (double) exception.getPosted() / 1024;
        LocalizableError error = new LocalizableError("validation.file.postBodyTooBig", format
                .format(max), format.format(posted));
        if (fieldName == null)
            context.getValidationErrors().addGlobalError(error);
        else
            context.getValidationErrors().add(fieldName, error);
View Full Code Here

        boolean passwordMatch = this.formUser.isPasswordMatch();
        boolean compliant = this.formUser.isPasswordPolicyCompliant();
        ValidationErrors errors = new ValidationErrors();

        if (!passwordMatch) {
            errors.add("password", new LocalizableError("password.nomatch"));
        }

        if (!compliant) {
            errors.add("password", new SimpleError(passwordPolicy.getDescription()));
        }
View Full Code Here

        if (formUser.hasPassword()) {
            boolean passwordMatch = this.formUser.isPasswordMatch();
            boolean compliant = this.formUser.isPasswordPolicyCompliant();

            if (!passwordMatch) {
                passwordError.add("password", new LocalizableError("password.nomatch"));
            }

            if (!compliant) {
                passwordError.add("password", new SimpleError(passwordPolicy.getDescription()));
            }
View Full Code Here

        boolean compliant = this.formUser.isPasswordPolicyCompliant();
        ValidationErrors errors = new ValidationErrors();


        if (!passwordMatch) {
            errors.add("password", new LocalizableError("password.nomatch"));
        }

        if (!compliant) {
            errors.add("password", new SimpleError(passwordPolicy.getDescription()));
        }
View Full Code Here

    public Resolution login() {
        PersonManager pm = new PersonManager();
        Person person = pm.getPerson(this.username);

        if (person == null) {
            ValidationError error = new LocalizableError("usernameDoesNotExist");
            getContext().getValidationErrors().add("username", error);
            return getContext().getSourcePageResolution();
        }
        else if (!person.getPassword().equals(password)) {
            ValidationError error = new LocalizableError("incorrectPassword");
            getContext().getValidationErrors().add("password", error);
            return getContext().getSourcePageResolution();
        }
        else {
            getContext().setUser(person);
View Full Code Here

        // Add validation error with parameters for max post size and actual posted size (KB)
        DecimalFormat format = new DecimalFormat("0.00");
        double max = (double) exception.getMaximum() / 1024;
        double posted = (double) exception.getPosted() / 1024;
        LocalizableError error = new LocalizableError("validation.file.postBodyTooBig", format
                .format(max), format.format(posted));
        if (fieldName == null)
            context.getValidationErrors().addGlobalError(error);
        else
            context.getValidationErrors().add(fieldName, error);
View Full Code Here

TOP

Related Classes of net.sourceforge.stripes.validation.LocalizableError

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.