Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

<h:graphicImage> and MySQL BLOB

843842Apr 16 2004 — edited Apr 27 2006
I have a MySQL database which uses BLOB's to store user-supplied pictures, and would like to use the <h:graphicImage> tag to display the pictures on a JSP page. The problem is that simply parsing the BLOB data to a java.sql.Blob object within a bean and then going:

<h:graphicImage id="userpic"
alt="userpic"
value="#{MyBean.picture}">
</h:graphicImage>

causes a ClassCastException. Does anybody know how to get around this, or if it's even possible for me to do what I'm trying to do? Do I need to parse the Blob data into some other class (like a BufferedImage or something) in order to make it work?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 25 2006
Added on Apr 16 2004
25 comments
933 views