• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding c:import url=..

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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" />
 
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Conan King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Conan King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic