• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populate image dynamically in jsf

 
jajati behera
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Anyone could tell me how an image fetching from database will be shown in an application as an icon using JSF. I tried to do it by writing it a method in the bean and this method fetch the image data from db and convert into a type of StreamConent. In jsf, i used <p:graphicImage> as tag to retrive it.But it is not working. Any other way to do this,please advise.

Thanks
 
metin lapo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

you are actually half way there
just use a servlet which will serve the image stream
then in your jsf page the value will be your servlets link

it will be sth like

normal html
<img src="http://localhost/myapp/ImageServlet?img=11" alt="Image">

primefaces
<p:graphicImage value="http://localhost/myapp/ImageServlet?img=11" />


I have done this with jsf but not sure about primefaces
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic