0

Let's say I have this given namespace or url like this

http://localhost:8090/MyApp/pageowner/profile?id=1

where in that page or profile has an img tag.

and the path of the image being retrieved is like this

media/user_01/photos/imm_2011_01_06_17_48_32_332.JPG 

Where the media folder is located Web-Content.

so if I just want to access the file itself I could just do this

http://localhost:8090/MyApp/media/user_01/photos/imm_2011_01_06_17_48_32_332.JPG 

but how come when I am inside the pageowner namespace I could not access it. the url being returned is like this

 http://localhost:8090/HitPlay/pageowner/media/user_01/photos/imm_2011_01_06_17_48_32_332.JPG 

That gives me an error 404 not found.

it is not accessing the file in the root context or Web-Content. is there anyway I can specify that the file I am getting is in the root or Web content location if I am inside the pageowner namespace

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user962206
  • 15,637
  • 61
  • 177
  • 270
  • Related: http://stackoverflow.com/questions/3655316/browser-cant-access-find-relative-resources-like-css-images-and-links-when-cal – BalusC Jan 26 '13 at 12:22

1 Answers1

1

you could try using request.getContextPath() - it is used to return the portion of the request URL and specifies the context of the request.

Joseph Caracuel
  • 974
  • 1
  • 8
  • 15