Hai ,
           Iam using tomcat server for my project.Iam using  Transformer
Factory for linking xml and xsl.Can any one give me any suggestions where i
have to put  my xml and xsl in the tomcat or whether i have to give the path
in my coding.
Here is the coding of it,

// Imported TraX classes
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;
// Imported java classes
import java.io.*;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
// Imported servlet class
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
/** *  Use the TraX interface to perform a transformation in the simplest
manner possible
 *  (3 statements).
 */
public class simple extends HttpServlet
{
Transformer transformer;
public void doGet(HttpServletRequest req,HttpServletResponse res) throws
ServletException,IOException



 try{
 meth();
 }
 catch(Exception e){
 System.out.println("the exception is:"+e);
 }
}
public void meth() throws TransformerException,
TransformerConfigurationException,
           FileNotFoundException, IOException {
// Use the static TransformerFactory.newInstance() method to instantiate
 // a TransformerFactory. The javax.xml.transform.TransformerFactory
  // system property setting determines the actual class to instantiate --
  // org.apache.xalan.transformer.TransformerImpl.
 TransformerFactory tFactory = TransformerFactory.newInstance();

 // Use the TransformerFactory to instantiate a Transformer that will work
with
 // the stylesheet you specify. This method call also processes the
stylesheet
  // into a compiled Templates object.
 Transformer transformer = tFactory.newTransformer(new
StreamSource("c:/test/students.xsl"));
 // Use the Transformer to apply the associated Templates object to an XML
document
 // (foo.xml) and write the output to a file (foo.out).
try
{
File f =new File("mathew");
 f.mkdir();

 transformer.transform(new StreamSource("c:/test/student.xml"), new
StreamResult(new FileOutputStream("mathew/inbox.html")));

}
catch(Exception ex)
{
System.out.println(ex);
}
 System.out.println("************* The result is in
Transform*************");




}
}
This is working well in JSDK.But in Tomcat it is showing that page is out of
reach
Expecting the Suggestion
Cheers
N.Mathavaraj

Reply via email to