Here are two options:
Option 1:
This may not be the best answer, but it will do in a pinch...
You would need to use a InputStreamReader
to read the blob out of the column, and then create a FileOutputStream
and then create the file in a 'created' images directory. For example if you store you image files in a directory called /pics
, you could write the files out to a directory called /pics/generated
.
There are some drawbacks to this approach. For one you would generate a file every time the page is requested. which may work if the files will all have different names.
Option 2:
You would use an InputStreamReader to read the blob from the row that is returned from your SQL. Create an OutputStream, using a byte[]
as the stream destination. Then it's just a matter of writing the byte[]
out to your JSP