java实现验证码
java验证码的实现(一)
收藏
1.ImageServlet类的实现:
package com.mobile.control;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ImageServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
// 生成数字和字母的验证码
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
BufferedImage img = new BufferedImage(68, 22,
BufferedImage.TYPE_INT_RGB);
// 得到该图片的绘图对象
Graphics g = img.getGraphics();
Random r = new Random();
&
相关文档:
在Eclipse中连上javadocs文档
一、 安装Eclipse
二、 从Oracle官网或者sun以前的官网上下载Java相应的docs文档
三、 & ......
现在用linux的朋友越来越多了,前几天就有两个朋友问我linux下怎么配置java环境,我想还有很多朋友想了解学习这方面的东西,就写一个完全一点的linux java环境配置吧,希望对大家有帮助。
一. 下载jdk5.0 for linux
到sun的主页 http://java.sun.com/j2se/1.5.0/download.jsp 下载jdk安装文件jdk-1_5_0_05-linux-i586 ......
// 导入IO库类
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
// 导入 POI库类
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi ......
package com.qiao.java;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iter ......