This is driving me mad, and I've already sought previous answers here and here, to no avail so far.
I am trying to follow this tutorial, which uses the Rome library for RSS feeds to output feed entries to a JSP using a servlet. I'm using Eclipse, and it won't recognize a "SyndFeed" class from Rome, even though I have placed the JAR in the project's build path and the WEB-INF/lib folder. Still says "Undefined Type" for the following code:
<jsp:useBean id="syndFeed" scope="request" type="SyndFeed" />
Above this, I have:
<%@ page import="com.sun.syndication.feed.synd.SyndFeed" %>
<%@ page import="com.sun.syndication.feed.synd.SyndEntry" %>
<%@ page import="java.util.Iterator" %>
My servlet, using Rome, is basically straight from the tutorial:
public class RssServlet1 extends HttpServlet {
private static final long serialVersionUID = 1L;
private RequestDispatcher indexJSP;
@Override
public void init(ServletConfig config) throws ServletException {
ServletContext context = config.getServletContext();
indexJSP = context.getRequestDispatcher("/WebContent/index.jsp");
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
URL feedURL = new URL("http://rss.cnn.com/rss/cnn_tech.rss");
SyndFeedInput syndInput = new SyndFeedInput();
SyndFeed syndFeed = null;
XmlReader xmlReader = new XmlReader( feedURL );
try {
syndFeed = syndInput.build( xmlReader );
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (FeedException e) {
e.printStackTrace();
}
request.setAttribute("syndFeed", syndFeed);
indexJSP.forward(request, response);
}
}
The servlet shows no compiling errors. All imports OK, including from com.sun.syndication.feed.synd.SyndFeed
.
I'm at a loss. Thanks in advance for your help!