Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Send XML as Servlet Response

Anonymous
Not applicable

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