Generating XML Document Using Java servlet
Java servlet is a java program which runs on web server for the purpose of generating response to the request submitted by browser.
You can use the power of this J2EE component to generate an XML document. You will understand this better with the help of following example:
public class XmlTemplate extends HttpServlet
As per the basic working technology of a servlet, in order to invoke it web server calls one of the following methods depending upon the requirement: doGet or doPost. After the servlet is invoked it does three basic tasks.
Firstly setContentType() method is called and appropriate information is passed about the type of content which going to be generated by servlet. It should be noted that setContentType() is a method of HttpServletResponse object which is called resp here in above example.
Then the same object HttpServletResponse is used here to create the object called PrintWriter named out in the example. This is done by using getWriter() method.
Finally XML tags are passed in the form of string using println() method of servlets.
| Generating XML Document Using Java servlet | How to Design a XML Document Easily | Understanding Advanced XML Concepts | Understanding Class Loaders in Java | Understanding The Basic Reasons for Development of XML | Understanding Various Methods of Formatting XML Data | Understanding XML Based Web Protocols | Working With ebXML An Indepth Overview | XML Database Program Knowing the Basic Concepts |