<html:img page="/image.do" />
This way you wont be confined to the webapp.
e.g
response.setContentType("image/jpeg"); response.setHeader("Cache-Control", "no-cache");
OutputStream ou = response.getOutputStream();
String imageStr = "/path to image"; java.net.URI imgUri = new java.net.URI(imageStr); File imageFile = new File(imgUri); RandomAccessFile raf = new RandomAccessFile( imageFile, "r" ); FileInputStream imageFileStream = new FileInputStream(imageFile); byte[] image = new byte[(int) imageFile.length()];
while ( (raf.read( image )) > 0 ){ ou.write( image ); }
ou.flush(); ou.close(); return null;
map the action
<action path="/image" type="com.sparrow.struts.ImageAction" />
On 15 Jan 2004, at 14:34, Alain Van Vyve wrote:
I have a JSP where I would like to show an image located outside my webapp (e.g. in a c:\photo directory) ...
How to do that with the <html:img> Struts tag ??
Thanks
Alain
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]