• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difficulty in image file accessing

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a web app. My all jsp files are located inside /WEB-INF folder. The jsps use a lot of files like , e.g- css, js , images. These are located in a folder outside /WEB-INF, and within the application context( say /sra).

Now I have a datepicker.js file (which is used by the jsp), which uses some image files. Both the image ad js file are residing in the same folder say /sra/js/datepicker.js and /sra/js/sra.gif.

But most surprisingly in the js I have to access the image file using the full path starting frm the context. In case I am giving any relative path it's not taking.

It's a major issue as my client can change the context name. In that case the images will never be laoded.

So if anyone has sol'n for this kindly post..

Regards-
Anirban
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should not be the case, if I got the thing right.
How about doing "./" ?
 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

you are also using the context root in the path
i.e. /sra/js/datepicker.js or /sra/js/sra.gif

instead of this just use the path like
js/datepicker.js or
js/sra.gif

Do not include the context root in the path.
Hope this will resolve your problem. :thumb:
 
Evacuate the building! Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic