Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<img> tag

 
Ganesh Podaralla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65223
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is covered in the JSP FAQ. You can obtain the context path programmatically and should never hard-code it.
 
Ganesh Podaralla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear Bibeault...That really helps..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65223
95
IntelliJ IDE Java jQuery Mac Mac OS X
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic