Expand my Community achievements bar.

Send XML as Servlet Response

Avatar

Former Community Member

Hi,

We need to display xml as response on the browser when a user enters a servlet path in the URL:

ex: localhost:4502/bin/showXML

I have set response ContentType to "text/xml". and written response as :

BufferedOutputStream outStream = new BufferedOutputStream(response.getOutputStream());
        
outStream.write("<to>Punit</to><from>Jindal</from>".getBytes());

 

But, it displays nothing on the browser. Any idea?

0 Replies