自定义简单验证码
我们使用 SimpleCaptcha http://simplecaptcha.sourceforge.net/ 在注册表单中创建验证码(在Tomcat上运行)
我们使用以下命令创建验证码:
Captcha captcha = new Captcha.Builder(300, 57).build();
验证码显示如下:
但是当我向验证码添加更多选项时,例如 Captcha captcha = new Captcha.Builder( 300, 57).addNoise().build();
,仍然以同样的方式显示,没有噪音。我尝试了更多选项,但仍然得到相同的结果。
有谁知道为什么会发生这种情况?
谢谢,
库尔特
We're using SimpleCaptcha http://simplecaptcha.sourceforge.net/ to creating a captcha in our registration form (running on Tomcat)
We create the captcha using:
Captcha captcha = new Captcha.Builder(300, 57).build();
and the captcha is displayed as follows:
But when I add more options to the captcha such as Captcha captcha = new Captcha.Builder(300, 57).addNoise().build();
, it's still displayed in the same way without the noise. I tried more options but still get the same results.
Does anyone know why this is happening please?
Thanks,
Kurt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我尝试了上面的代码(使用 java 1.6 版本),但它没有产生任何结果。原因是你没有 .addText()。 (我本想将此写为评论,但我对此没有足够的声誉)。这对我来说表明您上面的代码不是您的实际代码,也许您在发布时忘记了某些内容。
这是我使用的有效方法:
在 .build() 之前添加 .addNoise() 确实会显示噪音。
I tried the code above (with java 1.6 version) and it produces nothing. The reason is that you don't have .addText(). (I would have written this as a comment but I don't have enough reputation for it). This suggests to me that your code above isn't your actual code, maybe you forgot something when posting.
Here's what I use that works:
Adding .addNoise() just before .build() does show the noise.