user3392674
user3392674

Reputation: 19

How to display an image in jsp page?

I know that this question is being asked a lot but I still have a problem. I work on a web application using Apache-Tomcat and MySQL database to store the path of each image I want to display but it's not working so please if anyone write me down step by step how to display any image on a jsp page and where exactly I store my images for display on my webapp

Upvotes: 0

Views: 201

Answers (2)

Luís Cunha
Luís Cunha

Reputation: 155

I don't see why this wouldn't work with regular html, so it would depend on what path you are retrieving from MySQL, meaning if it is the full URL to the file or a relative URL to the file.

In the case of a full URL you just have to do the following: <img src="your_full_url_here"> In the case of a relative URL just prepend or append the missing information to reach the file, such as: <img src="your_relative_path' + restOfPathVariable>

Upvotes: 0

Nikhi K. Bansal
Nikhi K. Bansal

Reputation: 393

<div ><img src="<%=request.getContextPath() %>/images/logo.gif"  title="Your Title" /></div>

Upvotes: 3

Related Questions