that assumes you are not working with jsp anymore for that page ...
I cannot do that because my page contains a lot of other things ...

Do you think it is possible to integrate that code in my jsp page ?


At 15:59 15/01/2004 +0000, you wrote:
Have an action that write the image to the response


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" />


//

call the action

On 15 Jan 2004, at 15:45, Alain Van Vyve wrote: > I think It is an intersting debate about relative versus absolute > addressing ... > but I'm not relatively but absolutely lost ... > Here is my jsp source ... > What do I have to change ? > > Thanks > > > 1bfb385.jpg name="HotelListForm" > property='<%= "hotelList.hotel[" + i + > "].urlPhoto" %>' />' > alt=' name="HotelListForm" > property='<%= "hotelList.hotel[" + i + > "].urlPhoto" %>' />' > border=0 > > > > > > At 15:44 15/01/2004 +0000, you wrote: >> I think robert it right, i've just tested it too. And i don't think >> that anyone is confused between absolute and relative addressing. >> >> http://www.peevish.co.uk/slang/c.htm >> >> see chocolate fireguard >> >> >> >> On 15 Jan 2004, at 15:28, Martin Gainty wrote: >> >>> Robert >>> The client browser is making a request to a webserver using a >>> "relative >>> address" I think it would be best to understand the difference >>> between >>> "relative addressing" and "absolute addressing" >>> I invite you to read >>> http://www.drizzle.com/~slmndr/tutorial/relabs.html >>> -Martin >>> ----- Original Message ----- >>> From: "Robert Nocera" >>> To: "'Struts Users Mailing List'" >>> Sent: Thursday, January 15, 2004 10:25 AM >>> Subject: RE: accessing an image outside my webapp >>> >>> >>>> I don't think Tomcat does, but your local browser will. You are >>>> sending >>>> your browser a link that tells it to load a file on your file >>>> system. It >>>> will work fine if you are only running locally, but it won't work >>>> if you >>> try >>>> to access that link from a browser on another machine unless that >>>> machine >>>> also has the same file locally. >>>> >>>> -Rob >>>> >>>> -----Original Message----- >>>> From: Mark Lowe [mailto:[EMAIL PROTECTED]] >>>> Sent: Thursday, January 15, 2004 10:14 AM >>>> To: Struts Users Mailing List >>>> Subject: Re: accessing an image outside my webapp >>>> >>>> by jingo. it only works!! >>>> >>>> just src rather than href >>>> >>>> >>>> >>>> I thought tomcat wouldn't have access to anything outside the >>>> webapp. >>>> >>>> >>>> On 15 Jan 2004, at 15:03, Richard Hightower wrote: >>>> >>>>> seems like an odd request... but here goes... >>>>> >>>>> >>>>> >>>>> html:img supports three attributes for specifyin the location of an >>>>> image >>>>> forward (referes to a global forward), page (relative to the >>>>> current >>>>> web >>>>> context), and href (any valid URL). >>>>> >>>>> Rick Hightower >>>>> Developer >>>>> >>>>> Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm >>>>> >>>>> Struts/J2EE consulting -- >>>>> http://www.arc-mind.com/consulting.htm#StrutsMentoring >>>>> >>>>> -----Original Message----- >>>>> From: Alain Van Vyve [mailto:[EMAIL PROTECTED]] >>>>> Sent: Thursday, January 15, 2004 7:35 AM >>>>> To: [EMAIL PROTECTED] >>>>> Subject: accessing an image outside my webapp >>>>> >>>>> >>>>> >>>>> 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 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] >>>> >>>> >>>> -------------------------------------------------------------------- >>>> - >>>> 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] >>>> >>> >>> --------------------------------------------------------------------- >>> 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] > > > --------------------------------------------------------------------- > 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]

Reply via email to