Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Servlets 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 9th, 2009, 06:10 PM
Authorized User
 
Join Date: Jan 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Displaying images dynamically from database:)

Hey guys do you have any samples that can display images dynamically from database(sql query browser) and display it on jsp and servlets?
The attribute for my image is called: image(varchar)
Thanks:)


Thanks:D
 
Old July 9th, 2009, 09:11 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Ummm...varchar????

What kind of database allows images to be stored in a VARCHAR field???

You sure you aren't just storing the PATH to the image in that field, with the image actually in a disk file referenced by that path??

If you really have an image stored *IN* the database, it should almost surely be stored in a BLOB or BIT VARYING or similar field type. But, again, it depends on which DB your are using.
 
Old July 10th, 2009, 12:53 AM
Authorized User
 
Join Date: Jan 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ops sorry I made a mistake. Yeap it is the path for the image insetad of the original image itself. In eclipse web content I create a folder named images and it the folder there is Beanie image category whereby the image.jpg is encode in it.

Below is the code that I used to display out the images.
Code:
 
<td> <div style=""><img border="1" src="images/Beanie/<%=rs.getString("Image") %>" height="160" width="160" /></div>
</td>


Do you guys know how to display all the 100 images from the database dynamically?
Thanks:D

The software that I am using is called eclipse, tomcat6 and sql query browser.:D
 
Old July 10th, 2009, 03:38 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

I've never heard of "sql query browser" as the name of a database. But I think that's unimportant.

All you need to do is use the right SQL query and the loop through all the records.

Show the code you have in that page with the rs.getString( ). Where is the SQL it is using? Where is rs created? etc., etc.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing images in Database and displaying them Manoj Bisht ASP.NET 1.x and 2.0 Application Design 4 February 6th, 2010 03:06 AM
displaying images from database(mysqlquerybrowser) in jsp:) Peggie1990 JSP Basics 6 June 29th, 2009 06:47 AM
displaying images embedded in database jia ASP.NET 1.0 and 1.1 Basics 1 July 5th, 2007 07:06 AM
Displaying Images From Database Metalore BOOK: Beginning ASP.NET 2.0 and Databases 1 November 1st, 2006 11:45 AM
Displaying images from database in Crystal Report gp_mk Crystal Reports 7 September 7th, 2004 11:54 PM





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