Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: OutPut on browser???


Message #1 by bikashpaul_2001@y... on Fri, 27 Jul 2001 11:19:52
Hi Friends,

I have problem with my servlet file that running perfectly It giving 
output in server but I want output on broswer.My servlet writing a xml 
file.For this what should I add in my code .Can any one me the require 
code.That means how I add out.println statement in my code.Here is my 
code:-

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import com.megginson.sax.XMLWriter;
public class Writer extends HttpServlet
             {
		
               public void doGet(HttpServletRequest 
req,HttpServletResponse res)
		throws ServletException,IOException
                   {    
			res.setContentType("text/xml");
			PrintWriter out = res.getWriter();	  
			try{
	          		XMLWriter w = new XMLWriter();
			        w.startDocument();
 			        w.dataElement("greeting", "Hello, world!");
 			        w.endDocument();
			    }
			catch(Exception e){}
 
		    }
             }

Thanks in advance
Bikash


  Return to Index