DOJO Client-Side Debugging Through Server-Side Trace

Digg this!

Here's a cool trick for structuring debugging of DOJO applications. This technique originated from Rhys Ulerich, who work in WebSphere Telecom Web Services Server development. Rhys is working on an interactive web-based console on top of WAS 6.1 for the much improved Service Policy Management Console in our upcoming release (targeted around October time frame). This technique allows you to enable debugging from the server side (via the app server facilities) of DOJO logic that executes client-side.

The technique has two elements to it that are embedded into the JSPs that render the console contents. These JSPs also render the appropriate DOJO widgets, JavaScript, and UI contents. First, the following is used to determine the trace logging:


<%@page import="java.util.logging.Level"%>
<%@page import="java.util.logging.Logger"%>
<%!
    //  "this" is the compiled JSP class for either
    //  a) ScriptPreamble.jspf if using jsp:include
    //  b) including JSP page, if using @include
    final Logger logger = Logger.getLogger(this.getClass().getName());
%>

As part of deployment, JSP contents are compiled into corresponding Java classes that are used to output the JSP contents. This can be done as part of deployment or through pre-compilation. This code snippet creates an instance of the Java logger class as part of the JSP generated class. As a byproduct, this will register the logger instance with the WAS trace logging subsystem as part of class loading.

Next, the follow is included to enable DOJO widget debugging:

<!-- Enable client-side dojo debug by enabling server-side tracing -->
<!-- for at least Level.FINE on <%= logger.getName() %> -->

<%-- Prepare the djConfig object for DOJO bootstrapping --%>
<script type="text/javascript">
    djConfig = {    isDebug:
        <%= logger.isLoggable(Level.FINE) %>
    };
</script>

Based on the selected debugging level, this enables client-side debugging in the browser, using the same tracing subsystem as is typically used in WAS. This gives a familiar way to introduce debugging of this capability without having to introduce an additional mechanism to configure debugging.

Please help me I need

Please help me I need wireless data collection tool for my Blackberry and Motorola. It needs to let me do custom forms such as wireless inspection form. They need to support drop down menus, GPS, check boxes, capture photos, and bar coding. Please Help?

DOJO versus Scriptaculous?

I've been getting my AJAX fix using Scriptaculous.

I just had a peak at the DOJO API, looks like its loaded with features. I still kind of prefer the simplicity of Scriptaculous, but its more of a library of hacks than an "platform" it seems.