• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image display in jsp

 
kunal vermaa
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am displaying image in a jsp through the following command.


but i have to place the image in the "Webroot" folder of the project.. it is not displaying any other path image. how can i display an image placed anywhere in my system.?

i m using tomcat 5.0.25 and myeclipse 6.5.0..

please explain..
 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What's a server relative path? My complete path toward my image is "C:\Ujjwal\myWorkspace\Temp\WebRoot\static\logo.png".

And i would refer the image as "../static/logo.png".
 
kunal vermaa
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my full path is. "C:\workspace\cts\WebRoot\images\image6.bmp"

but it is only displaying those images inside the "webroot" or inner directory.. any image placed lets say in the desktop can't be displayed..

can you explain ?

and how can i display an image placed anywhere in the system..?

 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What path are you giving ?
 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did

img src = " C:/Users/usoni.SUN_MICROSYSTEMS/Desktop/images.jpg "

And the image got displayed correctly on my jsp from my desktop location.....
 
kunal vermaa
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i did this..


the image is displayed.. the full path is "C:\workspace\cts\WebRoot\images\image6.bmp"


but when i did this..


the image is NOT displayed..

i don't know what's happening..? please explain..
 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try this

Change the direction of "slash" in your path to something like this

img src="C:/Documents and Settings/hp/Desktop/wall/image6.bmp" alt="" name="image5" width="980" height="320" id=""

 
kunal vermaa
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i did what you told.. still not working...
 
kunal vermaa
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
somebody please help...
 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Are you sure the image is in that folder ? What is the size of that image ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read through the JSP FAQ entries on this issue? Your questions has already been answered.
 
kunal vermaa
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help me out.. i couldn't find it.. how should i give the path to display image in a jsp..??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic