Solved

code for logo placement on website

Posted on 2006-06-19
14
363 Views
Last Modified: 2008-03-06
I have website that displays thousands of products.

The site is written in .jsp and I would like a code implemented so that each time a product is displayed the manufacturers logo would appear.


For expample if a Toshbia product is selected then i would like a toshiba logo to display with it.
 http://www.ota.com.au/catalogue/details.jsp?productID=5606&tier4=16875&tier3=16870&tier2=16949&tier1=16944&type=vendor

Thanks


0
Comment
Question by:Adamylo
  • 6
  • 4
  • 2
14 Comments
 
LVL 7

Accepted Solution

by:
dttri earned 168 total points
ID: 16939534
Greetings,
What does your database structure look like? I think the easiest way is to store Manufacturer information along with their logo (eg, a string point to an image) in a table, and in the product table there is an additional field which describe who manufacture it. So when you display a product you can know its' manufacturer and display their logo accordingly.
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 166 total points
ID: 16939923
Yes, the image can be stored in the DB or a link to the image can be stored in the DB (in the same table which stores master info about the product). In your JSP, you can display the image by simply using the <img scr=""> tag and replace the src with the image URL. If you want to store the entire image in the DB, it can be retrieved this way:

http://www.javaalmanac.com/egs/java.sql/GetBlob.html
0
 
LVL 35

Expert Comment

by:girionis
ID: 16940119
I think it would be better to store the image on the disk and store the path to the image in the database. By doing this you wouldn't have to store all the binary data in the database and it would be faster to read it from the disk anyway.
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 35

Assisted Solution

by:girionis
girionis earned 166 total points
ID: 16940128
And here is some info on how to read the image from the disk: http://javaalmanac.com/egs/javax.imageio/BasicImageRead.html
0
 
LVL 35

Expert Comment

by:girionis
ID: 16940136
Although, on second though, you probvably won't need it since the browser can read the images from disk traight away.
0
 
LVL 7

Expert Comment

by:dttri
ID: 16940193
>>Yes, the image can be stored in the DB or a link to the image can be stored in the DB (in the same table which stores master info about the product)

Please correct me if I'm wrong. I think the link to the logo image should be stored in the manufacturer table which is different from the product table. Because there is a one to many relationship between manufacturer and product, and "logo" is an attribute of manufacturer not product (as in the question of Adamylo).
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16940218
It depends upon what image has to be displayed. If its the manufacturer logo - yes it should be stored with the manufacturer master info. If its an image for the product (like a different image for Toshiba laptop version xyz and Toshiba laptop version abc) then it should be with the product.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16940225
>> I think it would be better to store the image on the disk

Not on the client side, right? Otherwise it will be expected that all clients have a copy of the images, and moreover they need not even have Java. Its easier to host the images in the web-server within the context-root of the application and just give a link to it (like we do for normal images in a JSP application), so that the browser can directly download it.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16940232
>> I think it would be better to store the image on the disk

Not on the client side, right? Otherwise it will be expected that all clients have a copy of the images, and moreover they need not even have Java. Its easier to host the images in the web-server within the context-root of the application and just give a link to it (like we do for normal images in a JSP application), so that the browser can directly download it.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16940235
>> I think it would be better to store the image on the disk

Not on the client side, right? Otherwise it will be expected that all clients have a copy of the images, and moreover they need not even have Java. Its easier to host the images in the web-server within the context-root of the application and just give a link to it (like we do for normal images in a JSP application), so that the browser can directly download it.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16940248
Sorry for multiple posts - I got Page cannot be displayed and had to refresh :-(
0
 
LVL 35

Expert Comment

by:girionis
ID: 16940259
>> I think it would be better to store the image on the disk
>
>Not on the client side, right?

No, on the server, probably somewhere in the web app tree (if the images are only related to web application).
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
topping2 challenge 13 90
Why method in Java which is called from Runnable run() doesn't need to be 'static'? 1 24
split string containing \r\n in Java 46 43
null output 3 25
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question