RT,非常简单,上代码; <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import="java.awt.*" %> <%@page import="java.awt.image.*" %> <%@page import="javax.imageio.*" %> <%@page import="java.util.*" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <% int width=60; int height=20; String s=""; BufferedImage image=new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB); Graphics2D g2=image.createGraphics(); g2.setBackground(Color.BLUE); g2.clearRect(0,0,width,height); g2.setColor(Color.RED); g2.setFont(new Font("Arial",Font.BOLD,16)); Random random=new Random(); for(int i=0;i<4;i++) { int temp=random.nextInt(10); s+=String.valueOf(temp); g2.drawString(String.valueOf(temp),i*15,20); } g2.dispose(); image.flush(); ImageIO.write(image,"JPEG",response.getOutputStream()); out.clear(); out=pageContext.pushBody(); %> </body> </html>