Link to home
Start Free TrialLog in
Avatar of HappyEngineer
HappyEngineer

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start 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

  myObject.list()

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

Hope this makes sense :-)

Tim
Oh, the url for dojo is:

http://dojotoolkit.org