jcaptcha是 Java Completely Automated Public Test to tell Computers and Humans Apart。
验证码输出案例,包括声音:


使用起来很简单:
1.将 jcaptcha.jar file into the WEB-INF/lib
2.配置web.xml
3.在你需要输入验证码的页面表单加入:
4.在表单提交的接受servlet或Action或Controller中加入下面代码进行验证:
String userCaptchaResponse = request.getParameter("jcaptcha");
boolean captchaPassed = SimpleImageCaptchaServlet.validateResponse(request, userCaptchaResponse);
if(captchaPassed){
// proceed to submit action
}else{
// return error to user
}
开源项目网址:
jcaptcha
[该贴被banq于2009-09-23 11:06修改过]
中应该在jcaptcha.jpg加上绝对路径http://localhost:8080/你的项目WAR名/jcaptcha.jpg