pull image file from SQL server then displayed in web browser

J

Jason

Hi, all,
I have a question about image file, SQL Server and web. I have a image file
(*.tif) stored in MS SQl Server in binary format, when user click a button, how
can I pull this image file from SQL Server and using JSP to display it? or I
should use html instead?
Thanks in advance.
 
C

Chris Smith

Jason said:
I have a question about image file, SQL Server and web. I have a image file
(*.tif) stored in MS SQl Server in binary format, when user click a button, how
can I pull this image file from SQL Server and using JSP to display it? or I
should use html instead?

It's best not to use JSP to actually download and deliver the image.
You should use a servlet for that. You could use a JSP (if you need
other dynamic content on the page) or just plain HTML to write the IMG
tag that references the image. Just remember to map a servlet to the
request URI that's listed in the SRC attribute of the IMG tag. From
that servlet, do your JDBC stuff, and call getOutputStream on the
response object to write the results there.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top