File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Regarding c:import url=.." Watch "Regarding c:import url=.." New topic
Author

Regarding c:import url=..

Conan King
Greenhorn

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="http://jakarta.apache.org/tomcat/index.html" />


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
Greenhorn

Joined: Aug 31, 2003
Posts: 23
Hi,

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

javax.servlet.ServletException: javax.servlet.jsp.JspException: Problem accessing the absolute URL "http://jakarta.apache.org/tomcat/index.html". java.net.ConnectException: Connection refused: connect
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)

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

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

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

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

thanx
sanjay


Eat JAVA, Drink JAVA, Sleep Java
Conan King
Greenhorn

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Regarding c:import url=..
 
Similar Threads
Using c:import with JSF deferred expression
regarding access of another server
Read a URL?
Exception -- Content is not allowed in prolog
c:import tag, url value from variable