Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Rss from calendar items

The "WCB: JSP front-end design" forum contains threads on issues that are related to JSP front-end design while programming a WCB (WebManager Component Bundle). The Presentation & Element component contain JSPs that will be used for front-end rendering. Ask your questions related to these JSPs here. Some example topics: integration of AJAX, use of the taglibs, how to handle multiple websites, and so forth.

Answered
Not marked as answered yet

Forums  >  WCB: JSP Front-end design  >  Rss from calendar items


Author Rss from calendar items
johnsten



Posts: 59

Posted: 13-10-2009 11:38

Is it possible to generate rss from calendar items? If i use the following code it only generates a textline but the source looks good


source code of page


<?xml version="1.0" ?>
<rss version="2.0">
<channel>
<item>
<title>November event</title>
<link>http://webmanager.saus.nl</link>
<date>November 1, 2009 - November 3, 2009</date>
<location>Amsterdam</location>

<description>Dit is een financieel event in november</description>
</item>
</channel>
</rss>




source of RSSCalendarElement.jspf


<%@ page language="java" session="false" buffer="none" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.gx.nl/taglib/wm" prefix="wm" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<c:set var="calendarElement" value="${presentationcontext.element}" />
<c:set var="wmPage" value="${presentationcontext.page}" />
<c:set var="wmPageCurrent" value="${wmPage.current}" />
<wm:presentationProperty var="normalFont" label="normal" />
<wm:presentationProperty var="headerFont" label="header" />

<wm:text var="dateFormatLanguage" label="metatagvalue" />

<fmt:setLocale value="en" />

<channel>
<c:if test="${not empty calendarElement.calendarItems}">
<c:choose>
<c:when test="${not empty calendarElement.title}">
<title>${fn:escapeXml(calendarElement.title)}</title>
</c:when>
<otherwise>
<title>${fn:escapeXml(wmPageCurrent.title)}
</otherwise>
</c:choose>
<c:forEach var="item" items="${calendarElement.calendarItems}">
<item>
<title>${fn:escapeXml(item.title)}</title>
<eventDate><fmt:formatDate value="${item.startDate}" type="date" dateStyle="long" /> - <fmt:formatDate value="${item.endDate}" type="date" dateStyle="long" /></eventDate>
<c:if test="${not empty item.location}">
<location>${fn:escapeXml(item.location)}</location>
</c:if>
<description>${fn:escapeXml(item.description)}</description>
<c:if test="${not empty item.readMoreLink && not empty item.readMoreLink.link}">
<wm:link var="readMoreLink" reference="${item.readMoreLink.link.page}" absoluteUrl="true" />
<link>${readMoreLink.url}</link>
</c:if>
</item>
</c:forEach>
</c:if>
</channel>

PeterK



Posts: 9

Posted: 13-10-2009 13:02

It's possible to check your XML source here: http://feedvalidator.org/
Using the Webmanager community RSS presentation for a mediaOverview
will result in this XML result... which works just fine in a RSS reader... maybe this helps =>


<?xml version="1.0" ?>
<rss version="2.0">
<channel>
<title>rss</title>
<link>http://localhost:8080/web/show/id=83510/langid=43</link>
<description></description>
<item>
<title>VS sturen 13.000 man extra naar Afghanistan</title>

<link>http://localhost:8080/web/show/id=26111/langid=43/contentid=2</link>
<description>Er gaan 13.000 Amerikaanse militairen meer naar Afghanistan ....</description>
<pubDate>Tue, 13 Oct 2009 10:53:00 GMT</pubDate>
</item>
<item>
<title>New article</title>
<link>http://localhost:8080/web/show/id=26111/langid=43/contentid=1</link>

<description>Contrary to popular belief, Lorem Ipsum is not simply random text</description>
<pubDate>Thu, 24 Sep 2009 11:18:00 GMT</pubDate>
</item>
</channel>
</rss>

johnsten



Posts: 59

Posted: 13-10-2009 13:14

Peter,

I've already used that presentation as an example I also used the feed validation but still the same problem.

ps I'm running 9.4.1

PeterK



Posts: 9

Posted: 13-10-2009 13:36 Solved

You could try to fill the title,link and description field right after the channel tag...


<channel>
<title>${fn:escapeXml(wmPageCurrent.title)}</title>
<link>${channellink.url}</link>
<description>${fn:escapeXml(wmPageCurrent.lead)}</description>
...



If I remove these fields my RSS reader fails...

johnsten



Posts: 59

Posted: 13-10-2009 15:35

I've removed the begin and end tag of item. Now it works thanks



<?xml version="1.0" ?>
<rss version="2.0">
<channel>
<title>November event</title>
<date>November 1, 2009 - November 3, 2009</date>
<location>Amsterdam</location>
<description>Dit is een financieel event in november</description>
<link>http://webmanager.saus.nl</link>

<title>December</title>
<date>December 1, 2009 - December 16, 2009</date>
<location>Utrecht</location>
<description>December evenement </description>
<link>http://webmanager.saus.nl</link>
</channel>
</rss>

johnsten



Posts: 59

Posted: 13-10-2009 15:55

This is the final file

Here a reference where you can find rss standards.

http://cyber.law.harvard.edu/rss/rss.html

thanks for your help


<%@ page language="java" session="false" buffer="none" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.gx.nl/taglib/wm" prefix="wm" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<c:set var="calendarElement" value="${presentationcontext.element}" />
<c:set var="wmPage" value="${presentationcontext.page}" />
<c:set var="wmPageCurrent" value="${wmPage.current}" />
<wm:presentationProperty var="normalFont" label="normal" />
<wm:presentationProperty var="headerFont" label="header" />

<wm:link var="channellink" reference="${wmPageCurrent}" absoluteUrl="true" />

<wm:text var="dateFormatLanguage" label="metatagvalue" />

<fmt:setLocale value="en" />

<channel>
<c:if test="${not empty calendarElement.calendarItems}">
<title>${fn:escapeXml(wmPageCurrent.title)}</title>
<link>${channellink.url}</link>
<description>${fn:escapeXml(wmPageCurrent.lead)}</description>
<c:forEach var="item" items="${calendarElement.calendarItems}">
<item>
<title>${fn:escapeXml(item.title)}</title>
<pubDate><fmt:formatDate value="${item.startDate}" type="date" dateStyle="long" /> - <fmt:formatDate value="${item.endDate}" type="date" dateStyle="long" /></pubDate>
<description>${fn:escapeXml(item.description)}</description>
<c:if test="${not empty item.readMoreLink && not empty item.readMoreLink.link}">
<wm:link var="readMoreLink" reference="${item.readMoreLink.link.page}" absoluteUrl="true" />
<link>${readMoreLink.url}</link>
</c:if>
</item>
</c:forEach>
</c:if>
</channel>

Back to top

New message: "Rss from calendar items"
Message:
bold boitalicd underline url quote code smile cool eek grin mad razz sad wink
 
© 2012 GX Software B.V.

Disclaimer

This website (Connect.gxsoftware.com) may discuss or contain opinions, (sample) coding, software or other information that does not include GX official interfaces, instructions or guidelines and therefore is not supported by GX. Changes made based on this information are not supported.  GX will not be held liable for any damages caused by using or misusing the information, software, instructions, code or methods suggested on this website, and anyone using these methods does so at his/her own risk. GX offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this website, including any liability resulting from incompatibility between the content of this website and the materials and services offered by GX. By using this website you will not hold, or seek to hold, GX responsible or liable with respect to the content of this website.