Java Simple Captcha Builder 放在哪里?
我是 java/java servlet 的新手。我需要 simpleCaptcha 作为表单,使用 html 和 javaservlet 作为代码。参考http://simplecaptcha.sourceforge.net/extending.html
。
Captcha captcha = new Captcha.Builder(200, 50)
.addText()
.addBackground()
.addNoise()
.gimp()
.addBorder()
.build(); // Required.
为了在 html 上创建验证码,我应该把这段代码放在哪里(java servlet)?
非常感谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要扩展 SimpleCaptcha 并自定义您的验证码,我的理解是您必须创建自己的
HttpServlet
(可能扩展SimpleCaptchaServlet
)。为此,我建议下载 源代码并查看SimpleCaptchaServlet
或StickyCaptchaServlet
。这就是SimpleCaptchaServlet
的doGet()
方法的样子:这应该是不言自明的:创建您自己的 servlet 并将您的自定义 Captcha Builder 代码放入
doGet() 方法。然后,按照安装部分的说明进行操作,但不要使用他们的 servlet 之一,而是声明您的 servlet在
web.xml
中。最后,打包/部署您的应用程序。示例捆绑在源代码发行版的examples
下。如果您需要有关 Web 应用程序的结构、依赖项和打包的更多指导,请查看它。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 atSimpleCaptchaServlet
orStickyCaptchaServlet
. This is what thedoGet()
method ofSimpleCaptchaServlet
looks 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.嘿,你看过这个页面了吗?
http://simplecaptcha.sourceforge.net/installing.html
这就像直接一样我认为它得到了。该项目为您提供了一些开箱即用的 Capcha servlet。您只需将它们映射到您的 web.xml 文件中。您可以继续操作并创建将调用它们的 jsp。
hey have you had a look at this page yet?
http://simplecaptcha.sourceforge.net/installing.html
this is about as straight forward as it gets I think. This project gives you a few Capcha servlets out of the box. You just have to map them in your web.xml file. You can follow along and create the jsp that will call them.