The servlet that gets the image is the src for the image. The servlet
should return the correct MIME type for the image (image/jpeg, image/png,
etc). Update the src attribute and the image should update. That's how I do
it. However I'm not writing straight JavaScript. You should put your
question to Stackoverflow.

On Thu, Oct 1, 2015 at 5:52 PM, Bill Ross <r...@cgl.ucsf.edu> wrote:

> Please let me know if there is a better place to ask Servlet/javascript
> interface questions.
>
> I have a slide show web page that does the logical equivalent of:
>
>     var img = new Image();
>     img.src = "/images/" + /servlet/getnextfile(params)
>     img.[onload]: document["image"].src = img.src; resizeImage();
>
> Rather than using the 'getnextfile' servlet to get a file name and then
> load it, I would like to have getnextfile return a stream of bytes from the
> database which seems feasible (streaming a BLOB I assume), but I don't know
> how to receive that into an Image (which wouldn't have 'src' set - ?).
>
> One motivation is to reduce the round trips to the server for faster
> response time.
> Another motivation is to keep the filename from the user.
>
> Thanks,
> Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)

Reply via email to