@WebServlet("CheckCodeServlet")
public class CheckCodeServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int weight = 100;
int hight = 50;
//1.创建一对象在内存中图片(验证码图片对象)
BufferedImage iamge = new BufferedImage(weight,hight,BufferedImage.TYPE_INT_RGB);
//2.美化图片
Graphics g = iamge.getGraphics();
//给图片填充颜色,首先设置画笔颜色
g.setColor(Color.PINK);
g.fillRect(0,0,weight,hight);
//给图片画一个矩形边框
g.setColor(Color.BLUE);
g.drawRect(0,0,weight-1,hight-1);
//给图片中随机生成动态的验证码,即随机的大小写字母和0-9;
String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";