fixing relative paths when including external html in a JSP page


I use <c:import url="whatever"/>  to include some external html in my JSP page.  It all works great except that the image URLS do not show up since they are realtive to teh external site.   Any solutions to work around this?

Who is Participating?

Improve company productivity with a Business Account.Sign Up

tbboyettConnect With a Mentor Commented:
are the images say on a webserver if so wouldn't you need to specify say the ip and port in order for them to work properly?

<img src=""/>
Can you show the code for the images?
bqchristieAuthor Commented:
it is coming from another server so i cannot gaurantee what they will look like but they are html image tags i.e. <img src="/images/something.jpg"/>

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

bqchristieAuthor Commented:
that is correct.   how would you go about changing the relative url to include the host?
rrzConnect With a Mentor Commented:
>Any solutions to work around this?
Even if you did  parse the content and place the host into each img tag, I dont think it would work because  of security constraints. See 
Maybe there could be a way using  the class. But I don't know how. Maybe an expert will step in here.
All I can think of is to  use HTML frames.
objectsConnect With a Mentor Commented:
you can't use relative url to access another host, you need to use absolute
bqchristieAuthor Commented:

Thanks for your replies but I think the question has been lost somewhere....

I have a bunch of html that includes several urls.  I need to replace the relative path with an absolute path.   Is there a regular expression or something that I could  use to do this.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.