Peter Smith wrote:
>
> The two input source files, normal.xml and normal.xsl are
> located at the same directory as XSLServlet.class is.
>

 <URL:http://java.sun.com/products/servlet/index.html>

 9.4 Directory Structure

    A special directory exists within the
    application hierarchy named WEB-INF . This
    directory contains all things related to the
    application that aren't in the document root of
    the application. It is important to note that
    the WEB-INF node is not part of the public
    document tree of the application. No file
    contained in the WEB-INF directory may be served
    directly to a client.


> FileReader xslReader = new FileReader("normal.xsl");
> FileReader xmlReader = new FileReader("normal.xml");

 Try:

   File f = new File("normal.xsl");
   out.println(f.getAbsolutePath());
   out.println(this.getServletContext().getRealPath("normal.xml"));

 and you'll see what's happening. If you want
normal.{xsl,xml} to be within the webapp, then you can
try something like ServletContext::getResourceAsStream()
(refer to the docs, path is relative to the context root)
or, depending on the container settings, you can give the
FileReader an absolute path (if you know the absolute
path, that is). Easiest is probably to put it within the
webapp, and use the ServletContext path routines to get a
location you can give to FileReader, but that's not always
possible...


-cks

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to