Show image as byte[] from database as graphic image in JSF page

前端 未结 2 1059
轻奢々
轻奢々 2020-11-28 14:12

I have image content as byte[] from database.

private byte[] image;

How can I show that byte array as a real graphic image in

2条回答
  •  爱一瞬间的悲伤
    2020-11-28 14:40

    Just bind one String variable to image on UI.

    
    

    For example you are loading the image byte[] from database then first encode it in base 64 String.

    String imageString= new String(Base64.encodeBase64(byte array fetched from database));
    

提交回复
热议问题