[前言]:圖片驗證在有關注冊和發表留言經常用到
http://java
代碼如下
<%@ page autoFlush=
com
<%@ page import=
<%
String chose=
char display[]={
Random rand=new Random();
for(int i=
{
temp=chose
display[i*
ran[i]=temp;
}
String random=String
session
%>
<%
out
response
response
response
response
int width=
BufferedImage image = new BufferedImage(width
Graphics g = image
//以下填充背景顏色
g
g
//設置字體顏色
g
g
g
ServletOutputStream outStream = response
JPEGImageEncoder encoder =JPEGCodec
encoder
outStream
%>
[
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20714.html