This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


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
 
Have you checked out Aspose?
 
subject: How to render BLOB data in jsf
 
It's not a secret anymore!