728x90
<?xml version="1.0" encoding="EUC-KR"?>
<%@ page contentType="text/xml;charset=euc-kr"%>
<%@ page import="java.util.*, java.text.*" %>
<%@ page import="" %>
<%
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
String serverPath = "http://" + request.getServerName();
if (request.getServerPort() != 80) {
<%@ page contentType="text/xml;charset=euc-kr"%>
<%@ page import="java.util.*, java.text.*" %>
<%@ page import="" %>
<%
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
String serverPath = "http://" + request.getServerName();
if (request.getServerPort() != 80) {
serverPath += ":" + request.getServerPort();
}
serverPath += request.getContextPath();
List<History> list = HistoryDao.getHistorys(2);
%>
<rss version="2.0">
<channel>
<title> 문서목록</title>
<link><%=serverPath%>/hist_lst.jsp</link>
<description>문서목록을 보실 수 있습니다.</description>
<language>ko</language>
<pubDate><%=sdf.format(cal.getTime())%></pubDate>
<lastBuildDate><%=sdf.format(cal.getTime())%></lastBuildDate>
<docs><%=serverPath%>/hist_rss.jsp</docs>
<webMaster>master@history.or.kr</webMaster>
<%
for (History b : list) {
%>
<item>
<title><%=b.getTitle()%></title>
<link><%=serverPath%>/hist_viw.jsp?histId=<%=b.getDataId()%></link>
<description>
<![CDATA[
[내용]<br />
<%=b.getContent()%>
]]>
</description>
<pubDate><%=b.getRegDate()%></pubDate>
<guid><%=serverPath%>/hist_viw.jsp?dataId=<%=b.getDataId()%></guid>
</item>
<%
}
%>
</channel>
</rss>
serverPath += request.getContextPath();
List<History> list = HistoryDao.getHistorys(2);
%>
<rss version="2.0">
<channel>
<title> 문서목록</title>
<link><%=serverPath%>/hist_lst.jsp</link>
<description>문서목록을 보실 수 있습니다.</description>
<language>ko</language>
<pubDate><%=sdf.format(cal.getTime())%></pubDate>
<lastBuildDate><%=sdf.format(cal.getTime())%></lastBuildDate>
<docs><%=serverPath%>/hist_rss.jsp</docs>
<webMaster>master@history.or.kr</webMaster>
<%
for (History b : list) {
%>
<item>
<title><%=b.getTitle()%></title>
<link><%=serverPath%>/hist_viw.jsp?histId=<%=b.getDataId()%></link>
<description>
<![CDATA[
[내용]<br />
<%=b.getContent()%>
]]>
</description>
<pubDate><%=b.getRegDate()%></pubDate>
<guid><%=serverPath%>/hist_viw.jsp?dataId=<%=b.getDataId()%></guid>
</item>
<%
}
%>
</channel>
</rss>
[출처] JSP로 RSS 구현하기 예제|작성자 doghole
'Dev. > Back-end' 카테고리의 다른 글
SmartEditor2 사진첨부기능 이미지업로더 (JSP model1) (43) | 2013.06.27 |
---|---|
정규화(Normalization) (12) | 2012.10.23 |
Ubuntu 10.10 에 Sql Developer 설치하기 (2) | 2012.10.16 |
Oracle 연습문제 2~7장 (13) | 2012.10.14 |
Ubuntu 12.04(x86) 에 Oracle11g Tomcat7 JDK1.7 Eclipse 깔기. (12) | 2012.10.04 |
댓글