Skip to main content

Posts

Showing posts from February 24, 2012

Creating captcha(random letter image) in jsp

A CAPTCHA is a program that can generate and grade tests that humans can pass but current computer programs cannot. For example, humans can read distorted text as the one shown below, but current computer programs can't: The term CAPTCHA ( for Completely Automated Public Turing Test To Tell Computers and Humans Apart ) was coined in 2000 by Luis von Ahn, Manuel Blum, Nicholas Hopper and John Langford of Carnegie Mellon University. At the time, they developed the first CAPTCHA to be used by Yahoo. Today we are going to learn how to create a random letter image known as captcha using servlet. Just a simple coding can do it copy the code below and save it and compile it you can directly view the servlet in tomcat using url “http://localhost:8080/captcha/servlet/CaptchaServlet” for this make adjustment in web.xml file by adding servlet and servletmapping entries. import java.awt.Color; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics2D; import java.a