Package net.sourceforge.stripes.validation

Examples of net.sourceforge.stripes.validation.LocalizableError


        squad.setLeader(leader);
        service.create(squad);
        return new RedirectResolution(this.getClass(), "all");           
        }catch(java.lang.NullPointerException e){
            ValidationErrors errs = new ValidationErrors();
            errs.add("membersCount", new LocalizableError("validation.membersCount.noMember"));
            context.setValidationErrors(errs);
            return context.getSourcePageResolution();
        }
       
    }
View Full Code Here


        user.setPassword(hashedPass);
       
        try{
        service.create(user);}
        catch(PersistenceException ex){
            getContext().getMessages().add(new LocalizableError("usernameTaken", user));
            return new RedirectResolution("/registration.jsp?reg_error=1");
        }
       
        getContext().getMessages().add(new LocalizableError(
        getClass().getName() + ".successMessage", this.user.getName(), this.user.getPassword()
            ));
    return new RedirectResolution("/login.jsp");
    }
View Full Code Here

    private String confirmPassword;

    @ValidationMethod
    public void validate(ValidationErrors errors){
        if (service.getAll().contains(user)){
            errors.add("user.username", new LocalizableError("usernameTaken"));
        }
    }
View Full Code Here

        //service.create(user);
       
        try{
        service.create(user);}
        catch(PersistenceException ex){
            getContext().getMessages().add(new LocalizableError("usernameTaken", user));
            return new RedirectResolution("/registration.jsp?reg_error=1");
        }
       
        getContext().getMessages().add(new LocalizableError(
        getClass().getName() + ".successMessage", this.user.getName(), this.user.getPassword()
            ));
    return new RedirectResolution("/login.jsp");
    }
View Full Code Here

    private String confirmPassword;

    @ValidationMethod
    public void validate(ValidationErrors errors){
        if (service.getAll().contains(user)){
            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

    public Resolution login() throws IOException {
        UserInformation userInformation =
            accountService.login(userId, masterPassword);
        if (userInformation == null) {
            getContext().getValidationErrors().addGlobalError(
                    new LocalizableError("loginFailed"));
            return getContext().getSourcePageResolution();
        }
        getContext().login(userInformation);

        HistoricLogin historicLogin =
View Full Code Here

    @ValidationMethod(on = "change", when = ValidationState.ALWAYS)
    public Resolution validateCurrentPassword(ValidationErrors errors) {
        if (!errors.containsKey("currentPassword")
            && !accountService.checkPassword(getContext().getUserInformation().getUserId(),
                                             currentPassword)) {
            errors.add("currentPassword", new LocalizableError("badCurrentPassword"));
        }
        return null;
    }
View Full Code Here

        if (!errors.containsKey("name")
            && cardService.cardExists(getContext().getUserInformation().getUserId(),
                                      name,
                                      null,
                                      getContext().getUserInformation().getEncryptionKey())) {
            errors.add("name", new LocalizableError("cardNameAlreadyExists"));
        }
    }
View Full Code Here

     */
    @ValidationMethod(on = "createAccount", when = ValidationState.ALWAYS)
    public void validateUserIdDoesntExist(ValidationErrors errors) {
        if (!errors.containsKey("userId")
            && accountService.accountExists(userId)) {
            errors.add("userId", new LocalizableError("userIdNotAvailable"));
        }
    }
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.