This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 94701

Summary: RFE: Need an easy to bind components to IMAGE/LOB database datatypes
Product: obsolete Reporter: bugbridge <bugbridge>
Component: visualwebAssignee: Gregory Murphy <gjmurphy>
Status: NEW ---    
Severity: blocker CC: sakthivelg
Priority: P2    
Version: 5.x   
Hardware: PC   
OS: Windows XP   
Issue Type: ENHANCEMENT Exception Reporter:

Description bugbridge 2007-02-06 19:00:03 UTC
Original status: 1-Dispatched; Suggested Status: NEW

Original Target Release: mako_dev; Suggested Target Milestone : Dev


Original submitter: sakthivelg

Description:
With Thresher, we don't have a way to bind Image component to a BLOB type.
I have bound image component to a Blob column via a BlobConverter but this
renders the image as text/string . Not surprising, because the converter sent it
as string.
How can i have image show up in table column easily? 
-Sakthi

>>You cannot intermix the binary output of an image with the text output 
>>of an HTML page -- this is an HTML restriction.  To render an image 
>>stored in the database, then, you are going to have to do a few high 
>>level things:
>>
>>* The component is going to have to render an HTML <img> tag
>>  with some appropriate URL.
>>
>>* The URL is going to have to point at a servlet inside your web
>>  application.  A common trick is to embed the "primary key" of the
>>  image you want in the incoming URL:
>>
>>        http://localhost:28080/myapplication/image/12345
>>
>>  where "/myapplication" is the context path, "/image/*" is mapped
>>  to an image retrieval servlet, and "12345" is the primary key of the
>>  desired image.
>>
>>* The image retrieval servlet will read the blob from the database
>>  and return it as a byte stream.  This will generally not be a JSF request,
>>  so you won't need a converter.
>>
>>I *think* there is an existing tutorial that describes this in more 
>>detail; I know that it was on the topic list, just don't know if it has 
>>been completed or not.
>>
>>Craig


>Thanks, Craig for confirming on how to deal with database images!
>>I have done this kind image retrieval (using servlet) for Reef testing.
>>I was wondering if we could use databinding for Image types, hence i was
>>trying to do something with BlobConverter.  Now, per your answer, there
>>seems to be no way like this.
>>
>>I thought MS VS.NET provides easy way to bind image components to
>>database columns via their dataproviders.
>>
>>  
>>

This would be an *excellent* RFE for post-Thresher -- could you file 
one, please?  The resulting implementation would have to do what I 
described, but we could auto-generate the appropriate lookup servlet 
somehow with some extra design time machinery.  That way, the user could 
just think they were binding to a database-sourced image, even though 
that isn't what is actually executed at runtime.

-Craig