fixing relative paths when including external html in a JSP page

Hello,

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?

Thanks
bqchristieAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
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?

Example:
<img src="http://192.168.188.00:8080/images/something.jpg"/>
0
 
tbboyettCommented:
Can you show the code for the images?
0
 
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"/>

0
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?
0
 
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  
http://www.devarticles.com/c/a/JavaScript/JavaScript-Security/ 
Maybe there could be a way using  the     java.net.HttpURLConnection class. But I don't know how. Maybe an expert will step in here.
All I can think of is to  use HTML frames.
0
 
objectsConnect With a Mentor Commented:
you can't use relative url to access another host, you need to use absolute
0
 
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.

Cheers
Bruce
0
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.