根据这个论坛某个前辈的代码,用rome生成rss,该文件名为rss.jsp
如果把这个rss feed地址 http://localhost:8080/rss.jsp复制到rss浏览器feed地址中,能够正确识别出来,
也能正确运行,现在问题是,如果直接在浏览器中输入 http://localhost:8080/rss.jsp
浏览器输出却是空白的,无法输出任何东西,请大家多多执教!
代码如下:<%@ page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312"%>   
<%@ page import="java.util.*,org.jdom.*,com.sun.syndication.feed.synd.*,com.sun.syndication.io.SyndFeedOutput"%>  
<%
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("rss_2.0");
    feed.setTitle("标题:测试一下rss生成");
    feed.setLink("http://localhost:8080");
    feed.setDescription("描述:测试rss生成");
    feed.setEncoding("GBK");
    List<SyndEntry> entries = new ArrayList<SyndEntry>();   
    SyndEntry entry;   
    SyndContent description; 
    entry = new SyndEntryImpl();
    entry.setTitle("这是第1个项目:first");
    entry.setLink("http://localhost:8080/rss.jsp?no=1");
    description = new SyndContentImpl();   
    description.setType("text/html");
    description.setValue("这是第1个项目的第1个描述");
    entry.setDescription(description);   
    entries.add(entry);
    feed.setEntries(entries);
    try {   
    SyndFeedOutput output = new SyndFeedOutput();  
    out.print(output.outputString(feed));   

  } catch (Exception ex) {   
    ex.printStackTrace();   
  }  
%>