<script>
var imageRequest = new AW.HTTP.Request;
imageRequest.setUrl('/servletImage/getImage');
imageRequest.setAsync(true);
imageRequest.response = function(xml) {
// get the src of new image generated
// like: /images/image_0048448464849849.gif
var resolver = xml.createNSResolver( xml.ownerDocument == null ? xml.documentElement : xml.ownerDocument.documentElement));
var value = xml.evaluate('//root//imageSRC', xml, resolver, XPathResult.ANY_TYPE, null).stringValue;
/*
example XML
<root>
<imageSRC>images/image_0048448464849849.gif</imageSRC>
</root>
*/
// create new image
var im = new Image();
im.src = value;
// set new image
document.getElementById('myImage').src = im.src;
// done
}
imageRequest.request();
</script>
<body>
<img src='/images/blank.jpg' id='myImage' name='myImage'>
</body>
response.setContentType("image/gif");
response.getPrinter().write(IMAGE_BYTES);
response.flush();
document.getElementById("image").src = document.getElementById("image").src+"?"+new Date().getTime();
This topic is archived.