aspose file tools*
The moose likes JSF and the fly likes How to render BLOB data in jsf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to render BLOB data in jsf" Watch "How to render BLOB data in jsf" New topic
Author

How to render BLOB data in jsf

Ajil Mohan
Greenhorn

Joined: Feb 20, 2010
Posts: 8
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


SCJP 1.5
Prasad Kumbhare
Greenhorn

Joined: Oct 18, 2007
Posts: 26
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



Thanks,
Prasad Kumbhare
SCJP 5.0, SCWCD 5.0, SCBCD 5.0
 
 
subject: How to render BLOB data in jsf