Generating XML RSS 2 feeds with JDOM 2 with a servlet

To better demonstrate how to generate XML RSS 2 feeds, we will use a servlet with JDOM 2 library. In this short blog, we will generate only the required elements plus a few options for feed reader interoperability. Please refer to the RSS 2 documentation for more of the optional elements and to learn more about the RSS 2 specifications. JDOM 2 is available for download here http://www.jdom.org/.

Below is a sample RSS 2 feed generated by the servlet that follows further down (contents edited for clarity).