• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

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
0
bqchristie
Asked:
bqchristie
3 Solutions
 
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
 
tbboyettCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
bqchristieAuthor Commented:
that is correct.   how would you go about changing the relative url to include the host?
0
 
rrzCommented:
>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
 
objectsCommented:
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now