(Ajax), JavaScript Technology, and Sun's Support for Dynamic Web Experience: A Conversation With Eduardo Pelegri-Llopart, Greg Murray, and Vivek Nagar

By Jim Inscore, May 2006  

Articles Index

Sun Microsystems may be most identified with the server side, but it has a long history on both sides of the client-server equation. Remember Java applets in browsers? The history of Java technology includes a number of initiatives to enrich the client with more dynamic content: Java Web Start software, Java Servlets, and JavaServer Pages and JavaServer Faces technology, among others.

Today, labels like Web 2.0 are attached to a more interactive experience on the web. But whether they represent a leap on the client side or are part of a long-established upward trend, the set of technologies that come together as Asynchronous JavaScript and XML ((Ajax)) provide developers with expanded abilities to deliver rich web experiences.

In this roundtable, we talk with three of Sun's leaders about (Ajax), the JavaScript language, and Sun's initiatives to enrich the web experience.

Eduardo Pelegri-Llopart is a Sun Distinguished Engineer and a longtime contributor to Java technology in the enterprise. He developed the first JavaServer Pages specification and was central to the development of the original Java Platform, Enterprise Edition (Java EE, formerly referred to as J2EE).

Vivek Nagar is the technology director for (Ajax)/Web 2.0 in the Enterprise Engineering group at Sun. A member of the original engineering team for the Java EE platform, Nagar has recently been involved in developing Sun's identity products.

Greg Murray is a founding member of the Java BluePrints team and has contributed to Sun's Java web-tier architecture and best practices for more than five years. He has been driving a new set of best practices with Ajax in the BluePrints Solutions Catalog.

Note: Sun has long supported JavaScript technology and worked with Netscape to roll it out around the same time as the Java platform 10 years or so ago. Most recently, Sun has reinvigorated the relationship with a new native JavaScript technology interpreter in Java Platform, Standard Edition (Java SE) 6, support for Ajax components in its Sun Java Studio Creator tool, and more.

As part of this initiative, Sun is also launching two new developer portals:

  • The JavaScript hub will become your one-stop resource for all things related to JavaScript technology.

question What's the big deal about (Ajax)? Why all the buzz?

Pelegri-Llopart: The reason Ajax is a big deal now is that the combined set of technologies included in (Ajax) deliver additional value to end users. The bottom line -- the motivation for developers -- is that the experience of AJAX-powered sites is better.

People who build web sites are competing for eyeballs, customers, so a better user experience wins. (Ajax)-enabled sites help deliver an experience in the browser that's close to a desktop application.

Nagar: I think the big reason Ajax is getting really popular these days is that it brings lots of interactivity to the web. Rich clients were much more capable of interactivity, where web content depended on a page-refresh model.

(Ajax) effectively removes the problems associated with the traditional click-and-wait web application models and allows web applications to provide the responsiveness and interactivity associated with desktop-based rich clients.

Pelegri-Llopart: These enhancements to the user experience can take many forms: activity within a page -- for example, a pop-up calendar -- without refresh. Or take the much more sophisticated Google and Yahoo maps, where you get a very smooth scrolling experience refreshing the image on the fly. It feels like you are actually navigating through the landscape without the need to download a whole client application. You get very sophisticated behind-the-scenes activity supported by both the client and the server.

Murray: Ajax definitely has buzz right now, but it might not be right for everyone or every web project. (Ajax) is limited to the latest browsers, and it exposes some browser-compatibility issues. It may also require new skill sets for many people.

On the other hand, you can achieve highly interactive rich web applications that are responsive and appear really fast. It may be debatable whether an Ajax application is really faster, but the user feels a sense of immediacy, because he or she gets active feedback while data is exchanged in the background.

question We've seen a number of technologies evolve in the past 10 years that help make the web user's experience more dynamic, including JavaScript and Dynamic HTML (DHTML). Is Ajax better than what we had before?

Murray: Well, DHTML is more of a page-description language that includes some dynamic content capabilities. And JavaScript is a browser-supported dynamic scripting language for interacting with the content, navigated using the Document Object Model (DOM) on the client. Not to leave out cascading style sheets (CSS), which define the presentation and are applied or modified using a JavaScript.

(Ajax), on the other hand, is a set of technologies -- Asynchronous JavaScript and XML -- that work together to deliver a more dynamic user experience. You have JavaScript on the client side to do local processing, maintain state, and send requests. You have standardized XML messaging for the requests and responses.

But the main difference of Ajax is the first letter: asynchronous. Rather than requesting a whole page at a time, an (Ajax) application makes asynchronous requests using XML-enabled browsers to update managed portions of the page. It's this mechanism that makes truly responsive UIs (user interfaces) possible.

There's also the fact that differences in support for JavaScript in browsers are now being resolved. Compatibility is converging, making it easier to build standardized web experiences.

Pelegri-Llopart: One value of an acronym is that once people can name something, they can talk about it.

Part of what contributes to Ajax as a solution are the other evolutions in capabilities. We've talked about better browser compatibility. Also, bandwidth today is broad enough that developers can deliver live interactive experiences without leaving behind a larger potential audience. Of course, CPU performance and additional memory in client machines makes them powerful enough to do the real-time processing necessary.

The bar of interactivity experience has been raised so that now you have to have a really compelling user experience. And that's the kind of experience that Ajax enables.

question So you have Ajax on the client side and Java technology on the server. How do you get them working together?

Pelegri-Llopart: Java technology is completely compatible with (Ajax), and most AJAX-enabled web sites use Java technology on the server side. Request processing from an Ajax client happens on a Java server, and the rendering sent back to the client happens on a Java server. Java technologies, like Servlets and JavaServer Pages, can be used to generate plain old HTML or HTML that is AJAX-enabled.

Nagar: What Java technology does on the server side is encapsulate the JavaScript so that Java technology developers don't have to deal with complex JavaScript code and any associated portability issues. JavaScript can be fairly complex -- hiding it and encapsulating it on the server side makes it easier to use.

Murray: One of the things that the BluePrints team brings to the game is experience with best practices for Java technology-based web applications. We've started collecting and disseminating our best practices for using Ajax and Java technologies together. In fact, the BluePrints Solutions Catalog is morphing to include more and more best practices for building highly interactive web experiences using (Ajax), JavaServer Faces components, and other Java platform-based tools and technologies.

Pelegri-Llopart: We should also mention the relationship between Ajax and Java technology on the client side. It's still possible to write a map manipulation program as a Java application, then use Java Web Start software to deliver it as a stand-alone application. Or you can choose -- as Yahoo has -- to write a map manipulation program in a browser using (Ajax). There are always going to be trade-offs, and there will always be situations in which a developer will closely evaluate these options.

question The buzz around Ajax has been building for a while now. Is Sun late to the Ajax game?

Pelegri-Llopart: We've been tracking and working on this technology for quite a while at Sun. It's fair to say that we haven't made enough noise about our efforts, but Java BluePrints, for example, has been releasing stuff since at least the 2005 JavaOne conference.

Murray: We were also the first big vendor to do anything with (Ajax). We pushed out the BluePrints Solutions Catalog with Ajax in it in May 2005. We had a big splash at last year's JavaOne conference and articles on it in June. Many of the other larger companies didn't wake up to AJAX or publish anything until late last year. That said, we haven't created much for AJAX infrastructure other than defining the programming options and showing the JavaServer Faces programming model, but we're working on that.

Nagar: Besides providing guidance to developers to (Ajax)-enable their existing Java technology-based applications, Sun is providing a set of AJAX-enabled components integrated with Java technologies and tools. In addition, Sun has been working on providing better support for Ajax within future versions of the Java platform technologies.

question The Java and JavaScript technologies were introduced at about the same time, and some developers are still confused about the relationship between the two. Can you help sort that out?

Pelegri-Llopart: Well, the two languages have always inhabited different niches in the ecology of languages. The same developer may use one language in one case and another in the other.

The Java programming language is a static language intended to provide very productive performance, structured programming, high maintainability, and extensibility through object orientation, encapsulation, and so on.

JavaScript, as a dynamic tag language, may be easier to write, but it may also be harder to read. It's dynamically interpreted and a lot more quick and dirty. Of course, languages can always be used outside their space, and JavaScript developers do run up against limitations.

Murray: JavaScript is a scripting language. Although it can run in the JVM*, using the Rhino JavaScript interpreter, it generally lives in the context of a browser. JavaScript works closely with the browser to update documents based on the responses to user input and HTTP requests. It will be interesting to see the new uses for scripting languages as the JVM moves to better support scripting languages with Java SE 6, in which Java technology provides the service and business logic and a scripting language provides a productive way to tie all the logic together.

question So Sun supports Ajax in its tools and solutions, and Java SE 6 is introducing better support for scripting languages, including native JavaScript language support. Is there a bigger scripting story coming from Sun?

Pelegri-Llopart: Yes, it's a story we've been building up for the last two years or so. It revolves around more clearly distinguishing between Java -- the language -- and Java -- the platform. For historical reasons, both have the same name, but the Java platform is a set of libraries that can be manipulated with different languages. Although the Java language is closely tied to the Java platform, there are now ways to provide scripting language access to those.

Nagar: Rhino running on the Java VM -- one of the features of Java SE 6 -- is supported through the JSR 223 framework that lets you plug in multiple dynamic languages similarly. Of course, with scripting enabled in the base platform, derivatives like the next-generation Java EE platform will be able to take advantage of these capabilities as well.

Murray: To look into the future of scripting language support on the Java platform, all you have to do is check around the Internet. Some interesting projects include Rhino, Groovy, BeanShell, JRuby, Jython, Tcl, and others. So the community is interested in scripting on the Java platform. There's a good list of scripting languages at Java-Source.net. This list will grow with the release of Java SE 6.

Pelegri-Llopart: In the longer term, we want to use scripting not just on the Java SE platform but with the Java EE platform. We see a natural affinity between time-to-market requirements of the web tier, where many user interfaces have a short lifespan in which to look fresh and up-to-date, and scripting solutions on both the client and the server. Where application longevity is less of an issue, there are real productivity advantages to being able to quickly assemble applications using scripting language.

question What are Sun's offerings in Ajax for the different developer audiences you're targeting? Who do you see using this stuff?

Nagar: Sun provides developers with a comprehensive set of technology, tools, and guidance for developing and deploying (Ajax)-enabled applications.

For example, we were the first to market with a visual tool for Java technology and web developers, Java Studio Creator IDE. The launch of Creator 2 in January 2006 gave Java technology developers an easy-to-use tool, plus a rich set of JavaServer Faces components, many (Ajax)-enabled, available free for download. And we plan to enhance and expand the pool of AJAX-enabled JavaServer Faces components over time.

Of course, as Greg Murray mentioned, we're offering an expanding BluePrints Solutions Catalog of best practices for designing and implementing rich interaction on the web.

In the future, you'll see enhancements to tools like the NetBeans IDE and better support in our runtime environments, including Application Server and Portal Server. Our intention is to fully integrate Ajax technologies into our Java tools and Java platforms.

We are also looking at possibilities for partnering with some communities out there, some initiatives that we're interested in that we may align with or join forces with.

Murray: We think a majority of developers will never want to see JavaScript or CSS, so JavaServer Faces technology and Java Studio Creator IDE are for them. The real issue comes to those creating the nonexisting functionality. If we create components to fill in the gaps, someone somewhere is going to have to write some script.

We are working on a set of Ajax components -- jMaki -- to target both the visual web design and the hardcore Java developer audiences. The general developer view would be the Java tag handler interface -- the simple events-based scripting model. Developers who want to dig in their heels on harder enterprise problems can manipulate the scripts and templates through the Java models, accessing web-tier functionality with JavaServer Faces and JavaServer Pages technology and accessing enterprise features through EJB and other APIs.

question The Java Studio Creator IDE is positioned as the hot tool for building JavaServer Faces applications, but it's not clear that JavaServer Faces has won the web frameworks/architecture battle. How can Ajax and JavaServer Faces technology work together to move the ball on that issue?

Pelegri-Llopart: Well, there are two sides to that question. First, it's clear that Ajax on its own or with other frameworks may be the right solution for some developers.

Murray: We intend to announce the jMaki Ajax components by the JavaOne conference. They will be highly usable outside of JSF. These are (Ajax) widgets that you can use outside of JSF. The rich component model can be used in a variety of tools.

Nagar: But there are real advantages to providing Ajax support through JSF components. JSF components encapsulate JavaScript so that developers don't have to worry about it. Of course, it provides a good solution for existing Java -- and Java web application -- developers.

Pelegri-Llopart: What JavaServer Faces does well is manage and hide certain complex client activities like callbacks to the server.

An area where JavaServer Faces and JavaScript are highly complementary is text completion: The JavaScript performs completion on the client side, in code encapsulated by the component. That's a very natural abstraction that's easy to describe to someone building a web site at the author level. The JavaServer Faces component then handles callbacks to the server. This is a unit of functionality that a page author or designer can readily comprehend, in a single totally abstracted component.

Murray: We published an article on java.net almost a year ago about the synergies between JavaServer Faces and (Ajax), and we'll be refreshing it soon as part of our efforts to support developers.

question So how would a developer go about deciding between the array of toolkits and frameworks available for building (Ajax)-enabled clients?

Pelegri-Llopart: The landscape will continue to change because we're close to the bleeding edge. You have to choose in part based on technical merits, in part based on the vendor -- who they are, where their alignment is. Be prepared to mutate over time. What tools are you using now? If you want a visual tool, use Java Studio Creator IDE. It's a good place to start, a good tool to learn, and it's from a reliable vendor.

We like Dojo a lot, we're committed to it. It's done by a strong engineering group -- very strong at JavaScript -- with a very professional approach to toolkit, run test suites, and so on. Whatever vendor or community you go with, you need to ask yourself: Are they going to deliver a stable product, a good product, one that you can build on reliably?

Murray: We like the Dojo toolkit. It contains an intelligent packaging system, UI effects, drag-and-drop APIs, widget APIs, event abstraction, client storage APIs, and Ajax interaction APIs. Dojo solves common usability issues such as support for dealing with navigation, for instance, the ability to detect the browser's Back button.

We also like Prototype, the Yahoo UI Library, DWR (Dynamic Web Remoting), and Zimbra.

There's more on most of the issues about choosing and using Ajax in our (Ajax) FAQ.

question Will we see more about Ajax and scripting from Sun at the 2006 JavaOne conference?

Nagar: Sun will be talking about initiatives that provide better support for Ajax in the Java platforms, tools, and technologies.

Murray: We've definitely got some things we think developers will latch on to. The BluePrints team, the Java Studio Creator IDE team -- we'll talk about some interesting open-source and community projects.

Pelegri-Llopart: We'll have some news -- that's for sure.

For More Information

(Ajax) BluePrints
(Ajax) FAQ for the Java Developer
JavaScript technology hub page
(Ajax) hub page
Rhino JavaScript interpreter
Using JavaServer Faces Technology With (Ajax), by Greg Murray, Tor Norbye, and Ed Burns
Java Studio Creator IDE
NetBeans IDE
JSR 223: Scripting for the Java Platform
Java EE platform
Java SE 6

*As used on this web site, the terms "Java virtual machine" or "JVM" mean a virtual machine for the Java platform.

Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.