fixing relative paths when including external html in a JSP page

Posted on 2006-06-20
Last Modified: 2008-02-26

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?

Question by:bqchristie
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 16947473
Can you show the code for the images?

Author Comment

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"/>


Accepted Solution

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?

<img src=""/>
Technology Partners: 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!


Author Comment

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

Assisted Solution

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 
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.
LVL 92

Assisted Solution

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

Author Comment

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.


Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Facing this issue for maven proxy setting 2 45
batch vs regular insert in spring DAO 2 52
JDBC performance 8 35
Overriding a method 3 14
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

759 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