File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Problem with JSTL c:import Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with JSTL c:import" Watch "Problem with JSTL c:import" New topic
Author

Problem with JSTL c:import

Li Xin
Ranch Hand

Joined: Feb 06, 2004
Posts: 37
I tried to use c:import in my jsp like this:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>opusOFFICE</title>
</head>
<body>
<c:import url="http://www.google.com" />
</body>
</html>

However, I got this error on Tomcat 5.5.

javax.servlet.ServletException: javax.servlet.jsp.JspException: Problem accessing the absolute URL "http://www.google.com". java.net.ConnectException: Connection timed out: connect
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:844)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.import_jsp._jspService(org.apache.jsp.import_jsp:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

The strange thing is that I can access google from IE directly, does anyone have idea about this?

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

That is not a complete URL. You must specify the exact resource to import.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Li Xin
Ranch Hand

Joined: Feb 06, 2004
Posts: 37
But even if I specified some complete URL like http://www.oreillynet.com/onjava/blog/2006/08/the_future_of_netbeans_and_i_h.html

it is still the same.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The import happens on the server.

Are you sure your server has access to the internet?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with JSTL c:import