There is a whole bunch of different ways. You could use ClassLoader.getResource or ServletContext .getRealPath or pass in the path to the file with a Servelet init parameter.
On Sat, 18 Sep 2004 13:22:19 +0530, Eldho George <[EMAIL PROTECTED]> wrote: > Hai all > > Thanks to Chris, > Thanks to all for your reply. > I got the output with both xml and xsl as string.Instead of XsltInputHandler > i am used > javax.transformer. > > The following code will work perfectly. > > Source xmlSrc = new StreamSource(new StringReader(xml)); > > Source xslSrc = new StreamSource(new StringReader(xsl)); > ByteArrayOutputStream outStream = new ByteArrayOutputStream(); > driver.setOutputStream(outStream); > TransformerFactory tf = TransformerFactory.newInstance(); > Transformer transformer = tf.newTransformer(xslSrc); > Result result = new SAXResult(driver.getContentHandler()); > transformer.transform(xmlSrc, result); > > I have another problem.I have General.xsl and this General.xsl and my > HTML2PDF.java(servlet) > reside in the same folder.I am working with IBM Eclipse and jboss3.2.3.The > following is > my workspace path. > > D:\J2EEWorkspace\HTML2PDFConverter\HTML2PDFConverter\ > > My HTML2PDF.java(servlet) and General.xsl reside here.My problem is I want > to read the > the content from General.xsl and store it into a string inside HTML2PDF > servlet.I tried > with following. > > FileReader fr=new FileReader(new File("General.xsl")); > > But it showing file not found exception.Both servlet and General.xsl reside > in the same folder. > Why its showing this error?How can i specify the path here.? > > I also tried with > > url="http://localhost:8080/HTML2PDFConverter"; > String f=url+"/General.xsl"; > > FileReader fr=new FileReader(new File(f)); > But it showing the same error message.Because apply above url to File(),it > converted to > file protocol. > > How can i solve this problem?Any other solution is there... > > Please help me > > Thanks in advance > George > > ********************************************************************** > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager. > > This footnote also confirms that this email message has been swept by > MIMEsweeper for the presence of computer viruses. > > www.mimesweeper.com > ********************************************************************** > > --------------------------------------------------------------------- > 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]