Color getRandColor(int fc,int bc){
Random rand=new Random();
if(fc>255) fc=255;
if(bc>255) bc=255;
int r=fc+rand.nextInt(bc-fc);
int g=fc+rand.nextInt(bc-fc);
int b=fc+rand.nextInt(bc-fc);
return new Color(r,g,b);
}
%>
//设置页面不缓存
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires",0);
//在内存中创建图像
int width=60,height=20;
BufferedImage image=new BufferedImage(width,height,BufferedImage.TYPE_INT_BGR);
//获取图像
Graphics g=image.getGraphics();
//生成随机类
Random rand=new Random();
//设定背景颜色
g.setColor(getRandColor(200,250));
g.fillRect(0,0,width,height);
//设定字体
g.s