RSS feeds using JAVA

RSS feedsRSS feeds are always becoming used more and more. Using RSS feeds is a good way to keep updated on a particular subject, it is also a very good way to keep a website always updated without the need of manual updates. RSS feeds are very easy to install into a website and with their help, your website will never be out of date!

In order to add RSS feeds to your website, follow these steps below:


Assuming we want the latest RSS feeds about movies. We would primarily need the URL of the feeds.

In our case we will be using the following link providing Yahoo RSS:

Step 1: To begin with, the following libraries need to be installed: Rome and JDOME,  by adding the jar files to the project’s library. * Refer to bottom of page for download links of libraries!

Step 2: Create a new Java Servlet (name it

Step 3:  Add the following imports to Servlet:

import com.sun.syndication.feed.synd.SyndEntry;

import com.sun.syndication.feed.synd.SyndFeed;




import java.util.List;

Step 4: In the process request add the following two lines:

String printFeeds = getRSSfeeds(;


Step 5: Create a method and name it getRSSfeeds which contents should look like:

protected String getRSSfeeds(String urlFeed)


StringBuffer sb = new StringBuffer();



URL feedURL = new URL(urlFeed);

SyndFeedInput input = new SyndFeedInput();

SyndFeed feed = XmlReader(feedURL));

List list = feed.getEntries();

if(list.size() > 0)    {

for (int i = 0; i < list.size(); i++ )

{     String container = “<p class=\”RSSlist\”>”;


String title = ((SyndEntry)list.get(i)).getTitle();


String link = ((SyndEntry)list.get(i)).getLink();

String url = “ …


String endContainer = ”






catch(Exception e){}

finally   {            return sb.toString();            }

Step 6:
Finally all code is ready. All is left to do is to call the RSS feed method from the JSP files by using where ever desired on the page. This will display the title and a read more link. To call the servlet just copy and paste this include tag:

<jsp:include page=”RSSfeeds”/>
****************** Downloading Libraries ********************

You can find these Jar files from the following links:


JDome  DOWNLOAD HERE ( Make sure to download the following zip file: )

JDome important download notes:

You only need one jar file which can be found in the build file after extracting files from the zipped download.

Both jar files must be stored in a fixed location and added to library in the website project.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s