aspose file tools*
The moose likes JSP and the fly likes Image display in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Image display in jsp" Watch "Image display in jsp" New topic
Author

Image display in jsp

kunal vermaa
Ranch Hand

Joined: Jun 27, 2009
Posts: 51
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

Joined: Mar 28, 2007
Posts: 403
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".

Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
kunal vermaa
Ranch Hand

Joined: Jun 27, 2009
Posts: 51
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

Joined: Mar 28, 2007
Posts: 403
What path are you giving ?
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
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

Joined: Jun 27, 2009
Posts: 51
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

Joined: Mar 28, 2007
Posts: 403
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

Joined: Jun 27, 2009
Posts: 51
i did what you told.. still not working...
kunal vermaa
Ranch Hand

Joined: Jun 27, 2009
Posts: 51
somebody please help...
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
Hi,

Are you sure the image is in that folder ? What is the size of that image ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Have you read through the JSP FAQ entries on this issue? Your questions has already been answered.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
kunal vermaa
Ranch Hand

Joined: Jun 27, 2009
Posts: 51
please help me out.. i couldn't find it.. how should i give the path to display image in a jsp..??
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Image display in jsp