This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
JSP RESPONSE: <%@ page contentType="text/xml;charset=ISO-8859-1"%> // Write the XML in JSP file.
SERVLET RESPONSE: response.setContentType("text/xml;charset=ISO-8859-1"); // Print the XML in the response object.
NOTE: 1. Both the above approaches display the XML in the browser. 2. You can even generate dynamic content (say, bring data from backend and display in XML), the way you do normally. 3. If you want the XML to download as a document, you would have to send it as a response attachment.