int x0 = random.nextInt(width);
int y0 = random.nextInt(height);
int x1, y1;
Random random = new Random();
for (int i=0; i < 12; i++) {
x1 = random.nextInt(width);
y1 = random.nextInt(height);
g.drawLine(x0,y0,x1,y1);
}
//可以用java.awt.Graphics的各种画图函数
g.dispose();
ServletOutputStream sos = respond.getOutputStream();
JPEGImageEncoder encoder =
JPEGCodec.createJPEGEncoder(sos);
encoder.encode(image);