Integrating Captcha in JSF 2.0

Post moved to ExamPit please click below link to explore

Integrating Captcha in JSF 2.0…

Advertisements
This entry was posted in JSF 2.0 and tagged , , , . Bookmark the permalink.

12 Responses to Integrating Captcha in JSF 2.0

  1. vijay says:

    Eventhough a4j:support is used the page is getting refreshed. Rerender is not working.
    Unless the page is refreshed the the image is not changed. Please suggest us how we can do with ajax or a4j:support without refreshing the page.

    Please advice as early as possible

  2. mehmet says:

    thanks dude! you save my life!

  3. What i don’t realize is actually how you’re not actually a lot more smartly-appreciated
    than you might be now. You’re so intelligent. You know thus considerably relating to this subject, produced me individually consider it from so many various angles. Its like men and women don’t seem
    to be interested unless it’s one thing to do with Girl gaga! Your individual stuffs nice. At all times take care of it up!

  4. Pingback: kaptcha, JSF, RichFaces, captcha | Business World TI

  5. duke says:

    Thanks for the code. Saved me a lot of time. Using it with JSF2.0 (without RichFaces) and everything is working like charm. Thanks once again.

  6. Thanks, very helpful. I’ll prefer to change CaptchaAction to Validator:

    @FacesValidator
    public class CaptchaValidator implements Validator {

    public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    String userInput = (String) value;
    String captcha = (String) Faces.getSession().getAttribute(MyCaptcha.CAPTCHA_KEY);

    if (userInput == null || captcha == null || !userInput.equals(captcha)) {
    FacesMessage message = new FacesMessage();
    message.setDetail(“Wrong captcha”);
    message.setSummary(“Wrong captcha”);
    message.setSeverity(FacesMessage.SEVERITY_ERROR);
    throw new ValidatorException(message);
    }
    }
    }

    Use of Omnifaces’s Faces.getSession() can be changed to context.getExternalContext().getSession(true)

    Add this to any form (in RichFaces 5 r:ajax instead of a4j:support):

  7. shwesy says:

    So useful for me.Thanks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s