I am a newbie at java/java servlet. I need the simpleCaptcha for a form, using html and javaservlet for the code. With reference to http://simplecaptcha.sourceforge.net/extending.html.
Captcha captcha = new Captcha.Builder(200, 50)
.addText()
.addBackground()
.addNoise()
.gimp()
.addBorder()
.build(); // Required.
Where (java servlet) should I put this piece of code in order to create the captcha on html?
Thank you very much.
To extend SimpleCaptcha and customize your CAPTCHA, my understanding is that you’ll have to create your own
HttpServlet(maybe extendsSimpleCaptchaServlet). To do so, I suggest to download the source code and to look atSimpleCaptchaServletorStickyCaptchaServlet. This is what thedoGet()method ofSimpleCaptchaServletlooks like:This should be self-explaining: create your own servlet and put your custom Captcha Builder code in the
doGet()method. Then, follow the instructions of the Installing section but, instead of using one of their servlet, declare yours in theweb.xml. Finally, package/deploy your application. An example is bundled in the source distribution underexamples. Check it out if you need more guidance about the structure, the dependencies and the packaging of your web application.