• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to render BLOB data in jsf

 
Ajil Mohan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have to render an image in jsf page , which should be fetch from the data base. The data base which i am using is mysql. I got a suggestion that Servlet can be used for this purpose . But it didnt work here .The code which i try out is given below

finHome.jsp
<f:verbatim rendered="#{finMenuControlBean.imgCompForNonDiocese}">
<iframe src="/ImageServlet" frameborder="0" ></iframe>
</f:verbatim>

ImageServlet.java
public void doGet(HttpServletRequest request,HttpServletResponse response)..{
ServletOutputStream out;
response.setContentType("image/jpeg");
response.setContentLength(user.getCurrentRole().getOrg().getImage().length);
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma", "no-cache");
out = response.getOutputStream();
out.write(user.getCurrentRole().getOrg().getImage());
out.flush();

}

please help me
thanks
Ajil
 
Prasad Kumbhare
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please refer to this post. Did you try option suggested in there ?

http://www.coderanch.com/t/214433/JSF/java/render-myimage-from-backing-bean


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic