Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

install it

Add jcaptcha-all.jar, ehcacheimaging.jar (provided in distribution) and imagingehcache.jar (not provided see ehcache site) to your application class path, ie in you WEB-INF/lib folder.

...

Code Block
            boolean isResponseCorrect =false;
           //remenber that we need an id to validate!
           String captchaId = httpServletRequest.getSession().getId();
           //retrieve the response
           String response = httpServletRequest.getParameter("j_captcha_response");
           // Call the Service method
            try {
                isResponseCorrect = CaptchaServiceSingleton.getInstance().validateResponseForID(captchaId,
                        response);
            } catch (CaptchaServiceException e) {
                 //should not happen, may be thrown if the id is not valid 
            }
          
//do something according to the result!

Want some

...

more

Have a look to the modules provided to see how to integrate it with other frameworks.