JSF - Validator

0 respostas
Marques

Colegas,

Fiz uma classe EmailValidator e agora não sei como pegar/carregar as mensagem abaixo <"Email not valid"> do meu arquivo MessageBundle.properties.
Você pode me ajudar?

Muito obrigado,

Marques

public void validate(FacesContext facesContext, 
	            UIComponent uIComponent, Object object) throws ValidatorException {
	        
	        String enteredEmail = (String)object;
	        //Set the email pattern string
	        Pattern p = Pattern.compile(".+@.+\\.[a-z]+");
	        
	        //Match the given string with the pattern
	        Matcher m = p.matcher(enteredEmail);
	        
	        //Check whether match is found
	        boolean matchFound = m.matches();
	        
	        if (!matchFound) {
	            FacesMessage message = new FacesMessage();
	            message.setDetail("Email not valid");
	            message.setSummary("Email not valid");
	            message.setSeverity(FacesMessage.SEVERITY_ERROR);
	            throw new ValidatorException(message);
	        }
	    }
Criado 25 de maio de 2009
Respostas 0
Participantes 1