Solved

code for logo placement on website

Posted on 2006-06-19
14
362 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What is JNDI datasource in spring 1 50
topping3 challenge 14 69
java 8 lambda expresssions exception handling 3 74
arguments to jar 5 13
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now