BotDetect JSP CAPTCHA Integration Quickstart

1. Include CAPTCHA Library in your project

Include botdetect.jar into your web application's library folder (application/WEB-INF/lib). This file is included in the BotDetectComponentJSF download web archive.
If you want to share Captcha library among multiple applications copy it to your web container's (or domain's) library folder.

2. Show a CAPTCHA Challenge on the Form

On the very top of the source file for the web form you want to protect against bots, add:

<%@page import="botdetect.web.Captcha"%>

On the web form you want to protect against bots, add:

// Adding BotDetect Captcha to the page
Captcha captcha = Captcha.load(request, "exampleCaptcha"); 

<input id="captchaCodeTextBox" type="text" name="captchaCodeTextBox" />

3. Check User Input During Form Submission

When the form is submitted, the Captcha validation result must be checked:

  // validate the Captcha to check we're not dealing with a bot
  boolean isHuman = captcha.validate(request, 
    // TODO: Captcha validation passed, perform protected action
  } else {
    // TODO: Captcha validation failed, show error message

4. Configure your Application

Update your application configuration (web.xml) file.

<servlet-name>BotDetect Captcha</servlet-name>
    <servlet-name>BotDetect Captcha</servlet-name>

In-Depth JSP CAPTCHA Instructions and Explanations

Detailed JSP Captcha instructions and explanations can be found in the JSP Captcha integration how to guide.

Please Note

BotDetect Java Captcha Library v4.0.Beta3.7 is an in-progress port of BotDetect 4 Captcha, and we need you to guide our efforts towards a polished product. Please let us know if you encounter any bugs, implementation issues, or a usage scenario you would like to discuss.