Use Image Tag Library, an open-source project of Apache

Source: Internet
Author: User
Tags tld

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>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.