• 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

Including files in a jsp from different machine

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, it is still file url, but why is the connection refused problem coming?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic