tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexis <>
Subject storing images
Date Thu, 05 May 2011 18:19:51 GMT
Hello all, im facing an issue, ive been testing for a while different approaches without success.

I have a servlet that basically does

. creates an image
. store the image on disk
. returns an html <img> tag pointing to the stored image.

reason why the servlet doesnt returns the image directly using a response type image/png is
the servlet is called from an ajax script, this ajax script renders the inner text inside
a div on a jsp page on the same context that the server runs. ajax can only render html on
divs, there's no way to return binary content (the image) from the servlet to the ajax script.

So, i have to create the image on the servlet (done) , store the image on the disk (done),
and return the <img> tab also done. Thing is, where im able to store the image from
the servlet im not able to read it from the jsp. 

I tried with /tmp, i tried with servletcontext.getpath to store the file on that dir, nothing
seems to work. where should i store and reference those images to be written by the servlet
and read by the jsp?

thanks in advance

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message