1 / 4
文档名称:

JSP彩色验证码 字母 数字.doc

格式:doc   大小:24KB   页数:4页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

JSP彩色验证码 字母 数字.doc

上传人:drp539609 2019/10/18 文件大小:24 KB

下载得到文件列表

JSP彩色验证码 字母 数字.doc

文档介绍

文档介绍:<%***@pagecontentType="image/jpeg"import=".*,.*,.*,.*"pageEncoding="UTF-8"%><%!etRandColor(intfc,intbc){//给定范围获得随机颜色Randomrandom=newRandom();if(fc>255)fc=255;if(bc>255)bc=255;intr=fc+(bc-fc);intg=fc+(bc-fc);intb=fc+(bc-fc);returnnewColor(r,g,b);}%><%//("Pragma","No-cache");("Cache-Control","no-cache");("Expires",0);//在内存中创建图象intwidth=80,height=20;BufferedImageimage=newBufferedImage(width,height,);//获取图形上下文Graphicsg=();//生成随机类Randomrandom=newRandom();//(getRandColor(200,250));(0,0,width,height);//(newFont("TimesNewRoman",,18));//(newColor(0,0,0));(0,0,width-1,height-1);//随机产生155条干扰线,(getRandColor(160,200));for(inti=0;i<155;i++){intx=(width);inty=(height);intxl=(12);intyl=(12);(x,y,x+xl,y+yl);}//取随机产生的认证码(4位数字)StringsRand="";for(inti=0;i<4;i++){Stringrand=null;//随机生成数字或者字母if((10)>5){rand=((char)((10)+48));}else{rand=((char)((26)+65));}sRand+=rand;//(newColor((80),(80),(80)));//调用函数出来