Feeds integration

From MPDLMediaWiki
Revision as of 14:51, 2 February 2009 by Bastien (talk | contribs) (New page: =Feeds integration = ==Possible solutions== *[http://code.google.com/apis/ajaxfeeds/| Google AJAX Feed API] ==Google AJAX API== ===Cons/Pros=== ====Pros:==== * Very simple to implemen...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Feeds integration[edit]

Possible solutions[edit]


Google AJAX API[edit]

Cons/Pros[edit]

Pros:[edit]

  • Very simple to implement and to reuse.

Cons:[edit]

  • Google Terms of use : [1]

How to[edit]

To use the Google AJAX API please copy the following code on the jsp page:

<script src="http://www.google.com/jsapi">&#160;</script> 
<script>
  google.load("feeds", "1");
  function facesBlogInitialize() 
  {  	
      var feedControl = new google.feeds.FeedControl();
      feedControl.addFeed("http://url/of/the/feed/", "Feed name");
      feedControl.setNumEntries(6);
      feedControl.draw(document.getElementById("feedControl"));
  }
  google.setOnLoadCallback(facesBlogInitialize);
</script>

Remarks:[edit]

  • The first script element should not be minimized. To avoid the auto-minimization from JSF please write like it is on the previous code.
  • The url of the feed should be access from a backing bean with either

<h:outputText value="#{MyBackingBean.feedUrl}"/>

or replace the url with

document.getElementById("rssFeedUrl").value

and add in your jsp

 <h:inputHidden id="rssFeedUrl" value="#{BlogBean.rssFeedUrl}"></h:inputHidden>


More[edit]