...
This tutorial uses the CaptchaService and sub components (see Architecture overview).
Install it
Maven2 users
Tip | ||
---|---|---|
| ||
No release was published since Maven2 is working, but nightly build are available in Archiva : http://forge.octo.com/archiva/browse/com.octo.captcha/jcaptcha/1.0-SNAPSHOT In order to get the lastest version you have to add the following repository to your project POM : http://forge.octo.com/archiva/repository/forge-snapshots |
Add the following dependency to your project POM
Code Block |
---|
<dependency> <groupId>com.octo.captcha</groupId> <artifactId>jcaptcha</artifactId> <version>1.0-SNAPSHOT<0</version> </dependency> |
Without Maven2
...
Code Block |
---|
Boolean isResponseCorrect =Boolean.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
Tipinfo | ||
---|---|---|
| ||
Have a look to the modules provided to see how to integrate it with other frameworks : |
Tip | ||
---|---|---|
| ||
Please put some code showing integration with a new framework in a child page of the How To |