Taking Roller's JSON and jMakifying it - short video



Building on Dave Johnson's Roller/JSON post I wrote a simple application consuming Roller-generated data using the jMaki framework and NetBeans 5.5. jMaki, as any framework in the AJAX space, consumes JSON data and provides a wrapper technology around existing AJAX components.

I slightly changed Dave's formating of the Roller template:

#set($pager = $model.getWeblogEntriesPager())
#set(  $map = $pager.getEntries())
  {
     columns: {'pubTime' : 'Publish Time',
                 'title' : 'Title',
                    'Id' : 'Identifier',
          'commentCount' : '# comments' },
     rows: [
           #foreach($day in $map.keySet())
           #set($entries = $map.get($day))  
              #foreach($entry in $entries)
                ['$entry.pubTime',
                 '$entry.title',
                 '$entry.anchor',
                 '$entry.commentCount'],
              #end
           #end
  ]}

The page generating live JSON data is available at http://blogs.sun.com/alexismp/page/jsontest.

From NetBeans 5.5 with the jMaki plugin installed (get it from the Update Center), I simply created a Web Application with jMaki as the framework, dropped a DOJO table and changed it's service attribute to the URL generating to JSON data (actually I had to copy/paste the data so that it was available from the same domain) and run the application.

Pretty simple and I didn't see a line of JavaScript.
Here's the simple jMaki tag from the JSP source :

<a:ajax name="dojo.table"
       service="http://blogs.sun.com/alexismp/page/jsontest">


All of this is shown in this short screencast :



Update: the JSON content should really be using double quotes and ideally not end with a trailing comma (and your blog post titles shouldn't use double quotes :)
Update 2: the answer to my initial questions (different domains requiring me to copy paste JSON content in the video to workaround security constraints, quite ugly) are all described here. Sorry I didn't update the screencast.
Comments:

cool

Posted by guest on mars 30, 2007 at 04:39 PM CEST #

Post a Comment:
Comments are closed for this entry.
About

This blog has moved

Alexis Moussine-Pouchkine's Weblog

GlassFish - Stay Connected

Search

Archives
« juillet 2014
lun.mar.mer.jeu.ven.sam.dim.
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
   
       
Today
Blogroll

No bookmarks in folder

News

No bookmarks in folder