Thursday, November 10th, 2005

Ajax with Direct Web Remoting (DWR)

Category: Java, Toolkit

<p>

Philip McCarthy has another article over at IBM developerWorks. This time it is on Ajax with Direct Web Remoting.

Exciting as it is, adding Ajax functionality to your applications can mean a lot of hard work. In this third article in the Ajax for Javaâ„¢ developers series, Philip McCarthy shows you how to use Direct Web Remoting (DWR) to expose JavaBeans methods directly to your JavaScript code and automate the heavy-lifting of Ajax.

The article walks you through an example, a minimal model based on an online store.

Exposing Remote Calls

The magic of remoting with DWR is mainly in the XML config.

<!DOCTYPE dwr PUBLIC
  "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
  "http://www.getahead.ltd.uk/dwr/dwr10.dtd">
<dwr>
  <allow>
    <create creator="new" javascript="catalog">
      <param name="class" 
        value="developerworks.ajax.store.CatalogDAO"/>
      <include method="getItem"/> 
      <include method="findItems"/> 
    </create> 
    <convert converter="bean" 
      match="developerworks.ajax.store.Item">
      <param name="include" 
        value="id,name,description,formattedPrice"/>
    </convert>
  </allow>
</dwr>

Related Content:

  • Ajax apps with DWR
    A newly released podcast covers Ajax and Direct Web Remoting (DWR) including inside tips on using the Java open source library. It also covers common...
  • Using DWR with TIBCO General Interface
    This simple request/response cycle example demonstrates some of the basic utilities Direct Web Remoting (DWR) provides for making interactions between...
  • Ajax Learning Guide
    Are you a Web developer? The time has come to rethink your entire approach to developing Web applications. Find out about the Ajax approach...
  • Ajax Web application development celebrates fifth anniversary
    The term "Ajax" was first used five years ago in a blog entry by Jesse James Garret. We spoke with Garret and other Ajax pioneers and users about the...
  • Ajax Learning Guide
    Chances are, you've been doing JavaScript and XML developer work in Lotus Domino for quite some time. This old/new approach is causing quite a stir in...

Posted by Dion Almaer at 12:03 am
2 Comments

++---
2.9 rating from 7 votes

2 Comments »

Comments feed

I don’t know…

I never feel safe exposing server-side methods to JavaScript. Unless you have a documented API for users (did this once with SOAP – don’t ask) and structure it to accept that the users will control server-side parameters, you’ve just opened up a wealth of injection and DOS opportunities.

Not saying it can’t make some cool apps, just saying you’d better do it right the first time.

Comment by Shawn — November 14, 2005

hi,
i want to know a few details from u .
1). how we can do client side validations using DWR.
2). how i can populate values in dropdowns, where i am getting values from database.

let me know these few things as soon as possible.

thanks & regards,
ramu

Comment by ramu — August 14, 2007

Leave a comment

You must be logged in to post a comment.