response.setContentType("image/jpeg"); BufferedImage bi=new BufferedImage(100,80,1); Graphics gra=bi.getGraphics(); gra.setColor(new Color(255,0,0)); gra.drawRect(0, 0,100 , 80); gra.setColor(new Color(55,55,55)); gra.fillRect(0, 0, 100, 80); gra.setColor(new Color(0,255,0)); gra.drawLine(0, 0,100, 80); Font font=new Font("Fixedsys",Font.PLAIN,80-2); gra.setColor(new Color(255,0,0)); gra.setFont(font); gra.drawString("ST", 0, 80); OutputStream os=response.getOutputStream(); ImageIO.write(bi, "jpeg",os); os.flush();os.close();