Bistro!
Alexis Moussine-Pouchkine's Weblog
public enum Topic { Java, GlassFish, Tools, Sun, InFrenchInZeText, SDPY }

20070115 lundi janvier 15, 2007

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.
( janv. 15 2007, 06:09:19 PM CET ) Permalink Comments [1]


GlassFish Podcast
Get GlassFish V3 Preview
Support GlassFish Enterprise

Today's Page Hits: 871




bea conference glassfish groovy ips java javaee javafx javaone javazone jug metro mysql netbeans openesb openoffice opensource paris performance pkg podcast presentation sdpy sun swing techdays tips updatecenter v3 webservices
Links