jQuery in Action, 2nd edition*
The moose likes JSP and the fly likes Including files in a jsp from different machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Including files in a jsp from different machine" Watch "Including files in a jsp from different machine" New topic
Author

Including files in a jsp from different machine

Priyha Jootu
Ranch Hand

Joined: Sep 13, 2001
Posts: 47
Hi all,
The JSP pages i am developing is accessing different files from different locations and displaying them based on certain conditions.
I am using tomcat server. I need to access some files from within the tomcat webapps directory which i do by jsp:include tag( which takes a relative url). But some of the other files are to be accessed from other machines. jsp:include cannot be used for this. So, I used c:import standard tag library. The code looks like this:
<%@ page language="java" contentType="text/html"%>
<%@ taglib prefix="c"uri="http://java.sun.com/jstl/core" %>
<html>
<body>
<c:import url="initial.html" />
<c:import url="\\d10601\c$\try.html" />
</body>
</html>

The first c:import works because it is in the same directory as the jsp. But the second one doen't work. Can anyone explain why the second one is not working?
Please let me know how i can access files from different machines in my jsp.
Thanks,
Priyha.
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
I've never seen a URL like that second one, with the slashes pointing the wrong way, no http:, and no hostname.


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Priyha Jootu
Ranch Hand

Joined: Sep 13, 2001
Posts: 47
sorry for not explaining it:
<c:import url="\\d10601\c$\try.html" />
d10601 is the machine name. In windows network, we can access machines in the network using this format, c$ is the C:
Basically i am trying to access C:\try.html file in machine named d10601. If you put this url: \\d10601\c$\try.html in Internet explorer, the try.html opens in it.
I don't know how to access this file using jsp and display in my page. Please let me know how to do this,
Thanks,
Priyha
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
So it's effectively a local file name? Try putting file: at the beginning of the URL.
Priyha Jootu
Ranch Hand

Joined: Sep 13, 2001
Posts: 47
No, its not in the local machine.
Tomcat is running in a server, and the jsp residing in that server should access files from different machines with names like d10301, d10401, etc.
I tried this :
<c:import url="file://d10601.na.sas.com\\c$\\try.html" />
It is giving an error:

Connection refused error is coming, I got the same error when I tried this: <c:import url="http://google.com" />
Not sure why, help me find a solution to this.
Thanks
Priyha
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Regardless of whether it's on the local machinr or not, it's still a file url.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Priyha Jootu
Ranch Hand

Joined: Sep 13, 2001
Posts: 47
yes, it is still file url, but why is the connection refused problem coming?
 
Don't get me started about those stupid light bulbs.
 
subject: Including files in a jsp from different machine
 
Similar Threads
Differences between c:import and jsp:include
whats the difference between page 452 and 453
confused about the limitation of the jsp:include tag
help on c:import tag problem
Time interval for <jsp:include>..?