Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2009, 09:33 PM
Authorized User
 
Join Date: Jan 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default display images from database instead of the pathway:(

Hey guys do you know how to display blob images from mysql query browser instead of retrieving the path? I heard from my friend that it has something related to url:)


Code:
 
Product Name: Green Beanie 
Product Color: Green 
Product Description: It is natural green that makes you eyesight better and is eco-friendly 
Product Price: $22.00 
Quantity: 1 
Image: com.mysql.jdbc.Blob@b40ec4(the path whereby I want image instead of this:))
Thanks:D
 
Old July 8th, 2009, 09:46 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Basically what you need to do is
1. Write a servlet [or similar component] which takes id of the image [id column for the row] and reads the blob value.
2. Set appropriate mime type for the response object [image mime type].
3. Write the byte stream to the response object

On the jsp you have write <img ../> tag, and give the servlet path as 'src' attribute, with image id as request parameter [example src="myservlet?image=1234" ].

Hope it works :-)

In fact you'll find many post in this forum related to this topic, try searching for them :-)
__________________
- Rakesh
http://iam-rakesh.blogspot.com
 
Old July 8th, 2009, 10:11 AM
Authorized User
 
Join Date: Jan 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for ur help:)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Load Images from and Save Images to a Database cyndie VB.NET 2 August 17th, 2008 06:42 AM
Display images from lightbox kumiko Classic ASP Basics 2 February 25th, 2008 10:19 PM
how to display images embedded in a database . jia ASP.NET 1.0 and 1.1 Basics 2 August 1st, 2007 03:58 PM
How To Display Images in DataList abdul_owiusa General .NET 1 May 20th, 2005 09:01 AM
how to display images ? shirley65 C# 2 May 31st, 2004 08:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.