可以动态画图输出的JSP例子
<%@ page autoFlush="false"
import="java.awt.*,java.awt.image.*,com.sun.image.codec.jpeg.*,java.util.*"
%>
<%
out.clear();
response.setContentType("image/jpeg");
response.addHeader("pragma","NO-cache");
response.addHeader("Cache-Control","no-cache");
response.addDateHeader("Expries",0);
int width=640,height=480;
BufferedImage image= new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setColor(Color.white);
g.fillRect(0,0,width,height);
g.setColor(Color.red);
g.drawString("OK",270,220);
g.drawOval(10,10,100,100);
g.dispose();
ServletOutputStream sos = response.getOutputStream();
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
encoder.encode(image);
sos.close();
%>
上一篇: 广州,孕育中国服务机器人中心的最佳土壤
下一篇: 谷歌将开发能做外科手术的机器人