I'd say that the String path ="../dirList.jsp?path=//\\corportateFileServer\department\team\communication s\statusreports\monthlyConsolidatedReport&title=Team+Monthly+Status+Report" isnt a valid file path for
File file = new File(path) > -----Original Message----- > From: Michele Emmi [mailto:[EMAIL PROTECTED] > Sent: 09 June 2003 14:18 > To: [EMAIL PROTECTED] > Subject: Off Topic: JSP that reads and creates links to file directory > > > Hi, > I have created the jsp (below) that reads and creates links to file > directory(intranet, windows nt os). It works in ie to the extent that it > will read the file server directory and create the links, but > when I follow > the link I get an error from the browser (ie) saying the page was not > found...Any help would be greatly appreciated! > > Example of link that calls the jsp: > <a > href="../dirList.jsp?path=//\\corportateFileServer\department\team > \communications\status > reports\monthlyConsolidatedReport&title=Team+Monthly+Status+Report > ">Monthly > Report</a> > > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> > <%@ page import="java.io.*" %> > <%@ page import="java.net.*" %> > <%@ page import="javax.servlet.*" %> > <%@ page import="javax.servlet.ServletException"%> > <%@ page import="javax.servlet.http.*"%> > <%@ page import="java.util.*" %> > <% String path = request.getParameter("path"); > File file = new File( path ); > String title = request.getParameter("title"); > %> > > <html> > > <head> > <meta http-equiv="Content-Type" content="text/html; > charset=iso-8859-1"> > <link href="/xxx/sitestyle/guidestyle.css" type="text/css" > rel="stylesheet"> > <script type="text/javascript" > src="/xxx/scripts/dateScript.js"></script> > <title></title> > </head> > > <body style="margin: -1em; background-image: > url(/xxx/icons/background.gif); > background-repeat: repeat-y;"> > <table width="535" border="0" cellspacing="50" cellpadding="0"> > <tr> > <td valign="top" width="62%"> > <% out.println( "<div align='center' class='maintitle'>" + title + > "</div></br>Files Located at:<br> " + path ); %> > </td> > </tr> > <tr> > <td> > > <% if( !file.exists() || !file.canRead()){ > out.println( "Can't Read " + file ); > return; > } > if( file.isDirectory()) { > String [] files = file.list(); > for (int i=0; i< files.length; i++) > out.println( "<a href=\"file:"+path+files[i]+"\">" + files[i] + > "</a><br>"); > } > else > try{ > FileReader fr = new FileReader (file); > BufferedReader in = new BufferedReader( fr ); > String line; > while ((line = in.readLine()) != null) > out.println( line ); > } > catch ( FileNotFoundException e ){ > out.println( "File(s) not found" ); > } > %> > > </td> > </tr> > </table> > </body> > > </html> > > _________________________________________________________________ > MSN 8 with e-mail virus protection service: 2 months FREE* > http://join.msn.com/?page=features/virus > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]