BLOB images are displayed only on refreshing a page after an update via p:dataTable is made in PrimeFaces

前端 未结 2 1997
孤街浪徒
孤街浪徒 2021-01-12 14:05

I\'m displaying images stored in the form of BLOB in MySQL on a as follows.



        
2条回答
  •  时光取名叫无心
    2021-01-12 15:01

    hy,

    i have the same problem, but my image src is in hardisk not in DB. i have result the problem when i have use a random number but i dont read it. in general i have add a param in src image when this param is a random number.

    My solutionis like this:

    public class UserPage {
      private String fotoCVPath;
      //all variabile
        private String getRandomImageName() {
            int i = (int) (Math.random() * 10000000);
    
            return String.valueOf(i);
        }
     public void editImage() {
    //init the fotoCVPath
    fotoCVPath = fotoCVPath + "?tmpVal=" + getRandomImageName();
    }
      /**
         * @return the fotoCVPath 
    * * @author - asghaier
    * * Created on 29/mag/2014 */ public String getFotoCVPath() { return fotoCVPath; } /** * @param fotoCVPath the fotoCVPath to set
    * * @author- asghaier
    * * Created on 29/mag/2014 */ public void setFotoCVPath(String fotoCVPath) { this.fotoCVPath = fotoCVPath; } }

    and in you my page i have the element graphicImage like this:

    
        
           
        
    
    

    and when i like reload the image a update the component panelGrid.

    for my example i have use

    
    

    in

    i hope this mode help you for result your problem

提交回复
热议问题