Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Including files in a jsp from different machine

 
Priyha Jootu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never seen a URL like that second one, with the slashes pointing the wrong way, no http:, and no hostname.
 
Priyha Jootu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it's effectively a local file name? Try putting file: at the beginning of the URL.
 
Priyha Jootu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regardless of whether it's on the local machinr or not, it's still a file url.
bear
 
Priyha Jootu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, it is still file url, but why is the connection refused problem coming?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic