Solved

fixing relative paths when including external html in a JSP page

Posted on 2006-06-20
9
284 Views
Last Modified: 2008-02-26
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
Comment
Question by:bqchristie
9 Comments
 
LVL 5

Expert Comment

by:tbboyett
ID: 16947473
Can you show the code for the images?
0
 

Author Comment

by:bqchristie
ID: 16947569
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
 
LVL 5

Accepted Solution

by:
tbboyett earned 120 total points
ID: 16947586
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:bqchristie
ID: 16947958
that is correct.   how would you go about changing the relative url to include the host?
0
 
LVL 27

Assisted Solution

by:rrz
rrz earned 120 total points
ID: 16948227
>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
 
LVL 92

Assisted Solution

by:objects
objects earned 120 total points
ID: 16948800
you can't use relative url to access another host, you need to use absolute
0
 

Author Comment

by:bqchristie
ID: 16950397

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now