Using an open-source project Image Tag Library (http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/intro.html) of Apache 1.
Download necessary files
1) download Jakarta-taglibs:
Http://people.apache.org/builds/jakarta-taglibs-sandbox/nightly/
Extract the taglibs-image.jar and place it in/WEB-INF/lib.
Copy taglibs-image.tld to/WEB-INF/
2) download poor man's imaging wrapper: The Image Tag uses this package.
The http://www.mullassery.com/downloads/ can be downloaded for free after entering some necessary information
Decompress the package and copy pmiw. jar to/WEB-INF/lib.InWeb. xmlConfiguringImageServlet
<Context-param>
<Param-Name> imageservletmapping </param-Name>
<Param-value>/Gen-image </param-value>
</Context-param>
<Servlet>
<Servlet-name> ImageServlet </servlet-name>
<Servlet-class> org. apache. taglibs. image. ImageServlet </servlet-class>
</Servlet>
<Servlet-mapping>
<Servlet-name> ImageServlet </servlet-name>
<Url-pattern>/gen-image/* </url-pattern>
</Servlet-mapping> 3.InJspAdd implementation code to the page(For more information, seeHttp://technology.a.lunqun.com/read.php? Tid = 149894 & page = e & fpage = 1)
1) Add <% @ taglib uri = "/WEB-INF/taglibs-image.tld" prefix = "img" %>
2) Add at the top of the page
<%
Response. setHeader ("Pragma", "No-cache ");
Response. setHeader ("Cache-Control", "no-cache ");
Response. setDateHeader ("Expires", 0 );
%>
3) Add the following code where you want to add the verification code:
<%
Int num = (int) java. lang. Math. round (java. lang. Math. random () * 8999 );
String sRand = "" + (1000 + num );
Session. setAttribute ("userInfo. authcode", sRand); Verification Code
%> "x =" 7 "y ="-1 "font =" Times New Roman "bold =" false "size =" 22 "color =" 0x993399 "italic = "true"/> "x =" 17 "y ="-1 "font =" Times New Roman "bold =" false "size =" 22 "color =" 0x660033 "italic = "false"/> "x =" 27 "y ="-1 "font =" Times New Roman "bold =" true "size =" 18 "color =" 0xcc3366 "italic =" true "/> "x =" 37 "y ="-1 "font =" Times New Roman "bold =" false "size =" 22 "color =" 0x990099 "italic = "false"/> <% if (num <4500) {%> <%}%> </img: image>