-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: @AssertTrue in a JSF backing bean is never called
PostPosted: Thu Mar 19, 2009 7:25 pm 
Newbie

Joined: Thu Mar 19, 2009 7:06 pm
Posts: 1
Hey,

I have problems with @AssertTrue in my JSF backing bean. What I need is to check whether email address is unique, but the corresponding method in the backing bean is not called. If I understand it right, it should be called automaticaly. Validation on the getMailboxAddress function works just fine. What is wrong?

Here is the code of the backing bean

Code:
    @Pattern(regex = "^[a-zA-Z0-9._%+-]+$")
    public String getMailboxAddress() {
        if (mailbox == null) {
            return null;
        }

        if (mailbox.getAddress() != null) {
            int indexOfDomain = mailbox.getAddress().indexOf(mailbox.getMailDomain().getDescription()) - 1;
            return mailbox.getAddress().substring(0, indexOfDomain);
        }

        return null;
    }

    @AssertTrue(message = "{addressIsNotUnique}")
    public boolean isAddressUnique() {
        if (mailbox == null) {
            return false;
        }

        EmailService emailService = new EmailService();
        if (emailService.findMailboxByAddress(mailbox.getAddress()) == null) {
            return true;
        }

        return false;
    }



Here is the xhtml page:

Code:
<h:inputText id="username" label="#{emailBundle.mailboxAddress}" required="true" value="#{modules$email$MailboxEditBean.model.mailboxAddress}">
    <rich:beanValidator/>
</h:inputText>


I am using Hibernate Validator 3.0.0.GA.
Thanks for any help!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.