Yes, you can. I'm not going to post code, but here's a simple rundown of the steps:
* Write a servlet, which outputs an image. (see BufferedImage)
* In the servlet, use Image img = (Image) request.getSession().getAttribute("theImage"); to obtain the image object (which you need to pass to the servlet)
* use the same method to obtain the text: String myText = (String) request.getSession().getAttribute("theText");
* draw the image to the buffered image using g2d.drawImage(img, 0, 0, null); where g2d is the graphics context of the buffered image
* draw the text in the same way.
* Then, use
OutputStream out = response.getOutputStream();
response.setContentType("image/jpg");
try {
ImageIO.write(buf, "jpg", out);
} catch(IOException ioe) {
//handle it!
}
out.close();
That should sort you out :)