Error 404 - Not Found while transforming XML to HTML in java -


I have selected XML files in jsp page and then after the service file, I change these files and the HTML page Displaying data on But this does not work, when I select an XML file, and agree that I get an error below

  "Error 404 - not found"   < P> Down  java  code: 

  @WebServlet (name = "validation", urlPatterns = {"/ validation"}) Public class recognition HTTPSVervlet {Private constant The final string extends CONTENT_TYPE = "text / html; charset = windows-1252"; Stable document document; Public Zero Init (Circlet Config Config) has servlet upption {super.init (config); } Public Zero doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance (); Try {string xmlfile = request.getParameter ("feature"); String xsltfile = "C: \\ Documents and Settings \\ Administrator \\ Bureau \\ test \\ EDI3 \ EDI"; File stylesheet = new file (xmlfile); File datafile = new file (xslt file); DocumentBuilder Builder = Factory. NE DocumentBuilder (); Document = builder.parse (datafile); // Use transformer for output transformerfactor tFactory = transformerfacture. New Intens (); StreamSource stylesource = New StreamSource (stylesheet); Transformer Transformer = TFTC NAV Transstror (Schillerover); DOMSource source = new DOMSource (document); StreamResult Results = New Stream Result (System.out); Transformer. Transform (source, result); } Grab (Transformer Configuration Exception TCE) {// Parser System.out.printLine ("\ n ** Transformer Factory Error") error;); Use the system.out.println ("+ + tce.getMessage ()); // inherent exception; if any throttle x = TCE; if (tce.getException ()! = Null) {x = tce.getException ( );} X.printStackTrace ();} Error (Transformer Exception Tail) {// Parser System.out.printLN ("\ n ** Transformation Error"); error;) System.out.println ("" + te .getMessage ()); // Use the inherent exception, if any throwable x = te; if (te. Gate exceeds ()! = Null) {x = te.getException ();} X.printStackTrace ();} Catch (SAXException sxe) {// error generated by this application (// a parsing-initial error) exception x = sxe; if (sxe.getException ()! = Null) {x = sxe.getException ();} X.printStackTrace ();} hold (parser configuration exception ) {// Parser pce.printStackTrace () with specified options can not be made;} hold (IOException ioe) {// I / O error io.printStackTrace ();}}}  

Any guide or tutorial that I can understand is where I am going very much appreciated.

  response .set content type (CONTENT_TYPE); StreamResult Results = New Stream Result (response.getWriter ()); Transformer. Transform (source, result);  

The type of content already sets the encoding. The response can either write binary data with getOutputStream () or above, is encoding.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -