Thursday Aug 14, 2008

LOTD #2: Phobos - MVC framework based on JavaScript

Phobos is a lightweight, scripting-friendly, web application environment running on the Java platform. It provides a complete MVC framework where Controller is a JavaScript class, View is an Embedded JavaScript (EJS) file and Model is typically a mix of Java and JavaScript.

The tech tip explains how Phobos and jMaki can be used to create a simple Ajax-enabled application using NetBeans tooling and GlassFish for deployment.
Another application built using Phobos and jMaki was shown in JavaOne 2007 technical keynote.

All previous entries in this series are archived at LOTD.

Technorati: lotd phobos jmaki javascript netbeans glassfish

Friday Jun 01, 2007

JavaScript Everywhere - Detailed Instructions

These are detailed instructions for this screencast.


  1. Download GlassFish v2 latest build.
  2. In NetBeans 5.5 or NetBeans 5.5.1 Update Center, manually download and install the Ajax Update Center module. Run the Update Center and install all the modules supported by Ajax Update Center plug-in. This will require an IDE restart.
  3. In NetBeans menu, go to Tools, Palette Manager, Add jMaki Component Library and then add jMaki Charting widgets.


  1. Create a new NetBeans "Scripting" category and "Phobos Application" project. In CSS layout, scroll to the bottom and select "Two Fixed Right Sidebars" layout.
  2. In the 'Top Right Column', clear the text and drag/drop Yahoo Calendar widget.
  3. In the 'Right Column', clear the text and drag/drop BlockList.
    1. Replace

      value : [
      {title : 'jMaki Project Home', link : '', description : 'Where to go for the latest jMaki.' },
      {title : 'jMaki Widgets Home', link : '', description : 'The source for the latest jMaki widgets.' },
      {title : 'jMaki-Charting Home', link : '', description : 'Enables complex charts rendered on the client in any modern browser.' }


      service : "/xhp?id=rss"
  4. In Left Column, clear the text drag/drop Yahoo Tabbed View.
    1. Replace "content: 'Some Content'" with "url: '/tab1/show'".
    2. Replace "content: 'Tab 2 Content'" with "url: '/tab2/show', iframe: true".
  5. Right click on View, select New, Stylized Phobos View and name it tab1. In CSS layout, scroll to the bottom and select "No CSS style". This will automatically create a controller tab1.js which can be seen in the controller sub-tree. This demonstrates that a new controller is automatically created for every newly created view.
  6. Create tab2 using the instructions in the previous step.
  7. In tab1.ejs, clean all the text and drag/drop jMaki Line Chart widget from the palette.
    1. Change 'Months' to lineChartModel.xAxisTitle.
    2. Change the value of xAxis.labels to lineChartModel.xAxis.
    3. Change 'Temperature' to lineChartModel.yAxisTitle.
    4. Change the value of yAxis.tickCount from 3 to 10.
    5. Change the value of to lineChartModel.chartData.
  8. In tab2.ejs, clean all the text and drag/drop Google Search widget from the palette.
    1. Edit Static Content, resources, google, search, widget.json and add

  9. In 'controller', 'tab1.js', replace model definition

    model = {
        name = "app name"


    var lineChartData = module.application.generateChartData();
    lineChartModel = { xAxisTitle: "Month",
              yAxisTitle: "Bug Count",
              xAxis: "['November', 'December', 'January', 'February', 'March', 'April']",
              chartData: lineChartData
  10. In 'module', 'application.js', add the following code after onShutdown() function:

    this.generateChartData = function() {
      var chartData = [];

      var chartDataRow = this.getData('red', 'P1');

      chartDataRow = this.getData('orange', 'P2');

      chartDataRow = this.getData('yellow', 'P3');

      chartDataRow = this.getData('green', 'P4');

      return chartData;

    // get bug data for a priority and assign a color to it
    this.getData = function(color, priority) {
      var chartDataRow = {};
      chartDataRow["color"] = color;
      var priorities = [];

      for (var k=180;k > 29; k=k-30) {
        var val = new Packages.mypkg.BugQuery().getNewBugList(priority, k);
      chartDataRow["values"] = priorities;

      return chartDataRow;
  11. Right click on Project, select Properties, Run tab, Add Jar/Folder, then add this library. This jar file manifests an existing Enterprise application and queries bug tracking system in this case.
  12. Right click on Project, select Run Project.

Technorati: javaone jmaki phobos glassfish web2.0

Thursday May 17, 2007

jMaki Phobos made-for-each-other

If you could not attend JavaOne 2007 last week and would like to know how jMaki and Phobos are made-for-each-other, then watch this excerpt of the technical keynote (start @ 1:02 and finish @ 6:26). You'll hear me presenting :-)

A complete detailed screen cast on how to build this demo is available here. I plan to post written instructions soon as well.

Technorati: javaone jmaki phobos web2.0

Tuesday May 08, 2007

JavaOne 2007 - Day 1 Finished

After attending the keynote session, and getting ready for the technical keynote demo on JavaScript Everywhere! jMaki on client, Phobos on server, performing the keynote demo (which I think went well) and talking to many of you, alternating between booth #953 and booth #966 in the Pavilion, the day concluded with a Sun-only party at the third floor of W Hotel. Here are some pictures of movers and shakers at Sun. You'll see pictures of Rich Green, James Gosling, John Gage, Karen Tegan Padir and many others.

Tomorrow, I and Harold will be presenting on TS-4865: Takes Two to Tango (Wed 4:10 pm and Fri 1:30pm). See you there!

Thanks to Jeet for arranging the drinks in a timely manner, always a great resource and knows how to keep his team happy :)

Technorati: javaone glassfish jmaki phobos webservices wsit

Screencast #Web1: JavaScript Everywhere! JavaOne 2007 Demo

Developing a Web 2.0 app is really simple with Phobos and jMaki. Phobos is a light-weight scripting-friendly web application environment that runs on Java platform. jMaki is an Ajax framework and also provides a unified data model by wrapping components from existing toolkits such as Yahoo and Dojo.

Currently the primary language supported by Phobos is JavaScript and jMaki has support for Java, Phobos, PHP, and Ruby. Using the same language, JavaScript, on both client and server eliminates the impedance mismatch between the data format. Both of these technologies can be installed as plug-in modules in NetBeans IDE.

If you are attending JavaOne 2007, TS-6381 (Tue, May 8, 4:40 pm) and booth #953 in the Pavilion shows how easy it is to build a "Developer Dashboard" that allows you to monitor different activities of your project. If you want to build this application, then you can follow the screen cast.

Enjoy it here!

Three key points to be highlighted in this demo:

  1. jMaki and Phobos are made-for-each-other. They allow to use same skill set (JavaScript) on both client and server and eliminates the impedance mismatch by using the same data format on both the sides.
  2. NetBeans IDE provides a rapid development, run and test cycle increasing your development time. There is no deployment or compilation required.
  3. All these apps can be deployed on GlassFish V2 or V3, an open-source, production quality, and Java EE 5 compatible application server.

Technorati: javaone jmaki phobos glassfish web2.0 screencast

Thursday Apr 05, 2007

SWDP Forums and more coverage

It's been little more than 3 weeks since we released Sun Web Developer Pack (SWDP). SWDP is a new integrated toolkit from Sun Microsystems that consists of a collection of Web 2.0 technologies that enable next generation Web application development. Hope you are having fun using the different components (Ajax, Scripting and RESTful Web services) and building some cool applications with it. Leave a comment on the blog to share your experience.

If you have any questions, then please use Sun Web Developer Pack Forum for posting any questions such as installation, configuration, wish list of features and other general topics. For the different technologies bundled with SWDP, please post question to their appropriate alias listed below:

If you have a topic that does not belong to any of the topics listed above, please post a question to the forum. And if you still like posting a question to forum, instead of to an alias, then go ahead and we'll redirect the question for you.

Check out some more recent coverage on SWDP components:

Also feel free to leave a comment on the blog on the type of content (either blog or screencast) you'd like to see.

Technorati: swdp jmaki phobos web2.0

Monday Mar 12, 2007

Introducing Sun Web Developer Pack

Sun Web Developer Pack (SWDP) is a new integrated toolkit from Sun Microsystems that consists of a collection of Web 2.0 technologies that enable next generation Web application development. The toolkit consists of binaries, tutorial, documentation, samples (including source) to build your Web 2.0 applications and deploy them on industry-grade containers. It includes support for building rich user interface using Ajax technologies with Project jMaki & Project Dynamic Faces, light-weight Web services with Atom / REST APIs / WADL and server side scripting with Project Phobos.

Check the system requirements to see the list of supported platforms, JDK versions, browsers, web containers and Ant. These applications can be hosted on Sun Java System Application Server 9.x, Sun Java System Web Server 7.0 U1, GlassFish v1 UR1, GlassFish v2 and Apache Tomcat 6.

SWDP comes with NetBeans plug-ins that simplifies the design and development of Rich Internet Applications. These modules can be downloaded from NetBeans Update Center Beta with the name "Sun Web Developer Pack R1". Check out how to build jMaki and Phobos applications in a screencast.

Get the Sun Web Developer Pack
Simplify development of your Web 2.0 applications with this all-in-one download.

You can download SWDP as a stand-alone bundle and install on a supported Web container.  Alternatively, you can download SWDP bundled with Java Application Platform SDK Update 3 Preview. The SDK bundle can be downloaded in three different flavors:

  • Only SDK - Need to download JDK and NetBeans separately
  • SDK + JDK - Need to download NetBeans separately
  • SDK + NetBeans Enterprise Pack 5.5.1 Beta - Need to download JDK separately

After installing SWDP, it's recommended to view the latest online Release Notes. The binaries are accompanied by a comprehensive tutorial and an SWDP forum to post your questions. You can also view the list of SWDP bloggers or subscribe to the aggregated pipe.

You can view and download demos, samples, widgets and much more using these technologies here. Blueprints provide you guidelines and code for building these applications.

Technorati: swdp web2.0 ajax scripting javaee javaeesdk glassfish jmaki phobos netbeans

Tuesday Feb 27, 2007

jMaki, Phobos, Grizzly, and Toplink Essentials Aggregator

I built some more aggregators (mashing up feeds from Bloglines, Findory, Google Blog Search, Technorati, IceRocket) and here is the complete list:

Aggregator Search Term
Sun WSIT Bloggers All Sun WSIT Bloggers
GlassFish in Blogosphere glassfish
jMaki Aggregator jmaki
Phobos Aggregator phobos + scripting
Grizzly Aggregator grizzly + glassfish
Toplink Essentials Aggregator toplink + essentials

UPDATE: Found this great Yahoo! Pipes video tutorials.

Technorati: WSIT GlassFish YahooPipes Blogs jMaki Phobos Grizzly Toplink Essentials


profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.

Java EE 7 Samples

Stay Connected


« July 2016