This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi everyone..I need to find a way to build a registration page with 'Image Security Code' with JSP..I will display some random numbers/characters in an Image and the user will have to enter that code in order to register.(like yahoo does) I just wanna prevent automated registrations by doing this..I looked everywhere to find a source/article/code for this in JSP but I couldn't..Does anyone know how to do it ? Thanks..
You are going to have to display an image either selected from a set of static image files on the server or create one on the fly using the Java graphics capabilities. If you go dynamic, note that your JSP is just going to write an <img tag which has a src pointing to a servlet that will generate the image. You can use a session variable to contain the code. I suggest you get the JSP registration page generation working with a static image first. The topic of serving images has been discussed frequently around here, generally in the context of graphics generated from database results but the principle is the same. Bill
Joined: Jun 05, 2005
Originally posted by William Brogden: You are going to have to display an image either selected from a set of static image files on the server Bill
I think I'm gonna go with this option thanks Bill..What about the speed ? Does it make any difference from one to another ? (on the fly & static) Which one is faster you think ?
Author and all-around good cowpoke
Joined: Mar 22, 2000
What about the speed ?
Sigh - another person worrying about speed at the wrong point. Considering all of the time consuming operations involved in a servlet, the difference between serving a static image file and building one on the fly would be very hard to measure. "Premature optimization is the root of all evil." Get the code correct and clear first. Bill