Hi Bikash!
Change the content type to "text/html"
Try...

public void doGet(HttpServletRequest req,HttpServletResponse res) throws
ServletException,IOException
{
        //res.setContentType("text/xml");
        res.setContentType("text/html");
          PrintWriter out = res.getWriter();
          try
        {
                /*XMLWriter w = new XMLWriter();
                   w.startDocument();
                   w.dataElement("greeting", "Hello,world!");
                w.endDocument();*/
                out.println("Hello, world!");
        }
          catch(Exception e)
        {
                System.out.println("Exception: "+e.getMessage());
        }
}


Hth,
Manish Bhatnagar

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Bikash Paul
Sent: Friday, July 27, 2001 3:51 PM
To: [EMAIL PROTECTED]
Subject: OutPut On Browser???


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



__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

___________________________________________________________________________
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

___________________________________________________________________________
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