what i wish to understand is,
a) is it possible, without changing this line of code, to somehow refer the image without context-root, if the image is not on same machine which has the servlet container?
b) if doing this is not possible without changing code, what changes should be brought about so that the image could be loaded provided hosting configuration stated above.
~ access the image as /largeImages/Collection/a.jsp and not /context-root/large...
If the image is remote, you need to provide the entire URL.
If all remote resources are coming from the same place, you can shorten the URL by using the <base> HTML tag, but that affects all URLs so you can only use it if you want it to apply to all images, style sheets, links and script files.
Are you just looking for a shorthand for the pages?
Thanks for reply!
here is a background on where this question comes from:
i have an ear (having dynamic and static content) which has some jsp's that refer to images in below stated fashion (absolute path).
i have, to leverage upon powers of app server, moved the static content to a web-server and serve it from there.
this is done using plugins and directives used on webserver..an alias in httpd.conf tells the webserver...if a resource request comes with /context-root/... , it will be served by app server, or else the webserver can handle that (we can conveniently overlook this lest this becomes a question for server forums )
now to the problem..we already have so many jsp's having absolute path (url's to images/css etc.) that making a change everywhere is..what to say : )
and hence the question: can i refer to a static resource without using context-root?
>the image is remote.
>yes all resources will come from webserver and we can put them up into any structure in document-root.
>no this essentially is not a shorthand. i am trying to figure out a way to lookup a resource without actually referring to the context-root
please suggest further.
subject: how to load an image without using context root