Hi everybody, I am Chaitanya, I am working on captcha, I have a web page where the user has to enter the captcha text. For this I am using servlets.
The procedure what I am following is:
1> A servlet will receive the request.
2> Then it creates an attribute called "passed".
3> Then using nextInt(int) method of Random class, I will generate a random integer between 0 and 100
4> There is a folder named captchaimages where all the images(jpeg) are saved.
5> The names of the images are between 0 to 100.
6> There is a mapping file, which image represents which text.
7> So depending on the random number I get, I send the number to a view.
8> The view then requests for the image.
9> After the user submits the form, with AJAX I am sending the captcha text to a servlet.
10> The Ajax code will send the image number and the text which the user entered.
11> From the mapping file I'll check whether this number maps this text or not.
12> If yes the form will be submitted or else another random number will be generated which is not equivalent to this one and the ajax response is sent back.
This is what I have in my brain, please anyone tell me whether I am going in a right way or not.
Hi Mr. Gian, I googled about captcha, everywhere I go, I got details about captcha, nobody said how to implement captcha. I searched in jsp and servlets forum also. I did not get any clear information about how to do it.
Can you tell me how to do that. Is my solution a worst one?
Hi Mr. Gian, I searched JCaptcha examples, they were easy to understand. but one thing I did not understand is, from where the images are generated. They are not using any image folder or path of the captcha images. How the images are generated?
Love all, trust a few, do wrong to none.
posted 9 years ago
...you can drop the Mr.
Your solution is fine and a good learning experience when implemented, tested
and hardened to be up to the job for what captcha is meant to be: a security solution.
In a nutshell JCaptcha, has distinct parts (i.e. java classes) with different
responsibilities for things like font generation, background generation, etc.
E.g. you can tell JCaptcha how you want your image to look like when it
comes to font, its color and the background colors as well.