I decided to store uploaded to servlet pictures in DB. But how to show them in browser (in particular div with css image-backgr开发者_高级运维ound style) without page reload?
In details: I have an full-AJAX web client that works with java servlet.
Thanks.
- Create a servlet that accepts a name / id uniquely identifying the picture as a GET parameter
- Let the servlet load the picture from DB (as byte array or better - as stream)
- Stream the picture using response.getOutputStream()
- Don't forget to set the content-type to image/pngorimage/jpeg
- Refer to the image in the css with url: imageServlet?id=13214
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论