Thanks David. I will try it as long as i know about some details and options of my to be implemented project. please follow my other topic, maybe you can help too
> Yes, in general the <c:import > url="http://remoteServer/path" /> would > fetch the file via http protocol. The actual URL > you'd use is dependent > on the configuration of the remote server. > > --David > > henry human wrote: > > You gave me some idea and brought light to the > issue! > > Thanks > > > > <c:import> > > > url="http://remoteSystem.dns.com/http/path/to/file.txt > > > >> var="fileContents" /> > >> > > Am I right about above, that you mean my JSP ask > the > > tomcat on the remote machine and consequently the > > remote tomcat reads the file by means of the > incoming > > url, from the d:\archive\files directory? > > > > Or you mean that the files are at remote web > server > > directory ( f.i. \\tomcat\httpdirectory\files ) > and my > > JSP request for them ? > > > > > > --- David Smith <[EMAIL PROTECTED]> schrieb: > > > > > >> So... the "remote file" is available to the local > >> system on a network > >> drive. That's a fun one. There are a couple of > >> different ways to do this. > >> > >> 1. Using Windows fileshares > >> > >> Let me preface this by saying *I've* never done > >> this. The few times I've > >> had a tomcat server on a Windows machine, it only > >> ever accessed local > >> files. There are people on the list with way more > >> experience than I have. > >> > >> As I understand it, as long as tomcat is running > >> under a user account > >> that has privileges to read the remote file, you > >> could use a UNC path > >> with java standard file access classes and > methods > >> to read the file. The > >> mapped drive letter wouldn't work unless tomcat > was > >> only running while > >> you are logged in. In a jsp, this could be done > with > >> a scriptlet: > >> > >> <!-- import your classes at the top of the > jsp.... > >> --> > >> <jsp:scriptlet> > >> try { > >> FileInputStream remoteFileReader = new > >> FileInputStream( > >> "\\\\remoteServer\\archive\\files\\myFile.txt" ) > ; > >> // do something with the file > >> } catch ( Exception e ) { > >> // do something if the access fails > >> } finally { > >> try { > >> remoteFileReader.close() ; > >> } catch ( Exception e ) {} > >> } > >> </jsp:scriptlet> > >> > >> It should be mentioned the system account most > >> services run under by > >> default does not have any privilege to access > remote > >> files via UNC path, > >> so you'll have to customize your tomcat > installation > >> a little. ... Or > >> always be logged into the system and have it > running > >> as you which isn't > >> the most ideal method. > >> > >> 2. Using a webserver on the remote system > >> > >> This I have done and it's more platform > independent. > >> Your jsp can > >> request it from the remote server using standard > >> taglibs: > >> > >> (note standard.jar and jstl.jar must be in your > >> webapp's WEB-INF/lib > >> directory) > >> > >> <!-- import the core taglib from jstl at the top > of > >> the file. Docs for > >> the jstl taglib can help with this --> > >> > >> <c:import > >> > >> > > > url="http://remoteSystem.dns.com/http/path/to/file.txt" > > > >> var="fileContents" /> > >> <!--.... Do something with the file contents, > it'll > >> be available in the > >> fileContents page context attribute.... --> > >> > >> > >> --David > >> > >> henry human wrote: > >> > >>> Thanks David, > >>> I try to clarify my situation. > >>> I have a JSP running in local computer in > tomcat. > >>> > >> This > >> > >>> JSP should read from a remote machine. The files > >>> > >> are > >> > >>> under d:\archive\files. These directory which > >>> > >> provide > >> > >>> a repository functionality could not be transfer > >>> somewhere else. The files must be saved there. > > >>> 1) Scennario one: The remote machine does not > hava > >>> > >> e > >> > >>> webserver > >>> 2) Scenario two: a tomcat is running on remote > >>> computer > >>> > >>> My questions: > >>> 1) Do I need the webserver at all to access > >>> > >> remotely > >> > >>> the files? > >>> 2) Is it poosile to access the data on > d:\archive > >>> without to put them in a webserver directory or > >>> > >> not? > >> > >>> If no, do I need configuration for the webserver > >>> > >> (f.i. > >> > >>> tomcat)to allow access to the files from > outside? > >>> > >>> > >>> --- David Smith <[EMAIL PROTECTED]> schrieb: > >>> > >>> > >>> > >>>> Here's the picture you painted in the original > >>>> > >> email > >> > >>>> and I based my > >>>> answer on: > >>>> > >>>> 1. You have a jsp file on a tomcat server which > >>>> needs to read > >>>> information from a remote system > >>>> 2. The system containing the remote file has a > >>>> webserver you could put > >>>> the file in. > >>>> > >>>> The c:import tag is a java standard tag library > >>>> (JSTL) tag used to > >>>> import data form locations outside the jsp. In > >>>> > >> this > >> > === message truncated === __________________________________________________________ Gesendet von Yahoo! Mail. Mehr Möglichkeiten, in Kontakt zu bleiben. http://de.overview.mail.yahoo.com --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]