KK

Kim-'s-Blog.Object-Everything.I'm POJO.

.紀-錄.爲了忘卻的記憶..真的勇士,要敢于直面遇到的問題,敢于正視繁雜的原碼......在實踐中積累!

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  74 Posts :: 1 Stories :: 70 Comments :: 0 Trackbacks
1:Java Rss開源組件包很多,
如RSSLibJ、RSSLib4J、RSS Reader、FaceRSS等等,
本文使用rssutils.jar,Sun網站有提供下載 。
2:用Myeclipse建WebProject,Jar 放入lib中,tld放入WEB-INF下

3:web.xml

<? xml version = "1.0" encoding = "UTF-8" ?>

<! DOCTYPE web-app PUBLIC "-//Sun Microsystems,
Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >

< web-app >

< taglib >

< taglib-uri > /WEB-INF/rssutils.tld </ taglib-uri >

< taglib-location > /WEB-INF/rssutils.tld </ taglib-location >

</ taglib >

</ web-app >
4:index .jsp                 
      以CSDN為例,去網站找到Rss xml http://dev.csdn.net/rss/2.xml

<%@ page language = "java" import = "java.util.*"
 
pageEncoding = "BIG5" %>

<%@ taglib uri = "/WEB-INF/rssutils.tld"
prefix = "rss" %>

< html >

</ head >

< body >

    < rss:feed url = "http://dev.csdn.net/rss/2.xml"
    
feedId = "csdn" />

    < b > Image: </ b >

    < rss:channelImage feedId = "csdn" />

    < br >

    < b > Title: </ b >

    < rss:channelTitle feedId = "csdn" />

    < br >

    < b > Link: </ b >

    < rss:channelLink feedId = "csdn" asLink = "true" />

    < br >

    < b > Description: </ b >

    < rss:channelDescription feedId = "csdn" />

    < br >

    < ul >

        < rss:forEachItem feedId = "csdn" >

            < li >

                < rss:itemDescription feedId = "csdn" />

        </ rss:forEachItem >

    </ ul >

</ body >

</ html >

5:部署、訪問 OK.

posted on 2007-02-08 09:55 Kim' 阅读(1678) 评论(2)  编辑  收藏

Feedback

# re: 簡單RSS編程 Only parsing RSS (XML) and displaying its contents 2007-05-12 17:08 王梅
请问rssutils.jar哪里有下载?我在SUN的官方网站上没有找到啊  回复  更多评论
  

# re: 簡單RSS編程 Only parsing RSS (XML) and displaying its contents 2008-07-30 15:38 xinyu391
http://java.sun.com/developer/technicalArticles/javaserverpages/rss_utilities/rss_utils_1.1.zip  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航:
 
jj