File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes <img> tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "<img> tag" Watch "<img> tag" New topic
Author

<img> tag

Ganesh Podaralla
Greenhorn

Joined: Feb 22, 2010
Posts: 23
Hi,

I am trying to import an image under my application context.

I know that there are two ways to place the file location under src.

Absolute Path: <img src="http://www.someweb.com/webapp/logo.jpg" >

Relative Path: <img src=logo.jpg"> which displays the image based on the location of the jsp.
<img src="/webapp/logo.jpg"> which displays the image from the application context relative path. In this case, we need to mention the application context path (webapp). How can I display the image relative to the context path but without mentioning the context (webapp)? Is there anyway I can avoid mentioning "webapp" in <img src="/webapp/logo.jpg"> ??

Thanks,
Ganesh
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

This is covered in the JSP FAQ. You can obtain the context path programmatically and should never hard-code it.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ganesh Podaralla
Greenhorn

Joined: Feb 22, 2010
Posts: 23
Thanks Bear Bibeault...That really helps..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: <img> tag