Meaningless Drivel is fun!
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Regarding c:import url=.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Regarding c:import url=.." Watch "Regarding c:import url=.." New topic

Regarding c:import url=..

Conan King

Joined: Aug 31, 2003
Posts: 23
Hi Friends,

A small question on the import jstl tag. We can use an absolute URL in the url attribute when using the import tag.

Is there any restriction on the url, like it can be another application within the same web container, or can it be any url in the network. Can this be used from within a jsp in my application?

<c:import url="" />

King<br /> <br />SCJP 1.4, SCWCD 1.4
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
You can use any url with the <c:import> tag, even one from outside the web Container. So your example would work fine.

This is what makes <c:import> so much more powerful than <%@ incude> and <jsp:include>. It is the only one that can look outside the container.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Conan King

Joined: Aug 31, 2003
Posts: 23

I thought so. And tried with the same, However got this.

javax.servlet.ServletException: javax.servlet.jsp.JspException: Problem accessing the absolute URL "". Connection refused: connect

Can any of u tell why this is happening?
Sanjay pts
Ranch Hand

Joined: Nov 07, 2000
Posts: 357
I tried that and worked fine with me .
Hope you have include this line at begining

<%@ taglib prefix="c" uri="" %>

also may i know which version of tomcat are you using???


Eat JAVA, Drink JAVA, Sleep Java
Conan King

Joined: Aug 31, 2003
Posts: 23
Yes I have included the taglib directive on the jsp. I am using Tomcat 5.0
I tried changing the url to an html in another application within the same container and it worked fine. However it is failing when I use an external URL in the internet.

I have a proxy setting in my browser for accessing the internet, not sure if that is why I am getting the error.
I agree. Here's the link:
subject: Regarding c:import url=..
It's not a secret anymore!