This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hey, again i don`t know if this is the right forum, but here we go. my goal is to have a servlet that read data from a mysql databank and display it with xml. i have a java application wich transform the mysql data with dom parser and write them to an xslt file. when i run the app from a konsole everything is fine, but i don`t know how to display the data in a browser. any help is welcome thanx bernd
The default content type for a response coming from an HttpServelet is "text/html". What you'll need to do to display xml in the browser is somethig like the following... ..more code.. response.setContentType("text/xml"); java.io.PrintWriter out = response.getWriter(); out.println(xmlDumpedToAString); Note: The println() takes a String parameter. You'll probably need to have some code to transform your object (...I'm assuming DOM) into a string representation. Hope this helps,