need tutorial on AJAX used with Java webapps

JavaONE made many references to web services and AJAX, but I haven't found a simple tutorial on how to get started. I've got a lot of static stuff, but now I'd like to try doing some dynamic stuff.

In J2EE1.5 it's apparently easy to make web services just be adding a few annotations, but that's still in the future. For now, presumably I'd just need to have the web service call a servlet that returns xml?

I don't want to personally write any extensive javascript. I have no interest in wasting my time doing compatibility testing between lots of browsers. I want to use existing libraries and, possibly, just use taglibs that use existing javascript libraries.

I heard that one of the webapp frameworks used a library called dojo, but I don't know what it is.

I'm also interested in doing some dynamic page stuff that is not AJAX. For instance, I'd like to have a table that sorts its contents without hitting the server again. But, again, I don't want to write the javascript to do this myself.

So, possible capabilities I'd like:
- sort table without hitting server
- have struts form on page which submits by itself without needing to get info to redisplay the rest of the page. This may be overkill, but I think of this as iframes without iframes.
- have struts form that allows the user to add new text fields to a list of fields without hitting the server. For instance, if I have 3 fields, each of which has an arbitrary length list of parameters (which are text fields) then the user should be able to add new parameters without needing to hit server again.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DWR is the best AJAX for java lib I have seen...

It comes with examples :-)

Hope this helps (a bit)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DOJO is a pure javascript library to help do AJAX things

basically, you can get dojo to call servlets, then your servlet will return XML and dojo can parse this xml and regenerate html

(as far as I can tell)

DWR is a library that generates the mappings between your java classes (on the server) and the javascript running on the client...  then you can call


from javascript, and it will call the list method of an object on the server...

Hope this makes sense :-)

Oh, the url for dojo is:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.