Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Ryan Asleson

+ Follow
since Sep 15, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ryan Asleson

Your best bet is to start small and work from there. You can search the web for some tutorial articles on Ajax, and of course any of the fine books available will help you too.

Either way, I recommend that you first learn the basics of Ajax using the bare XMLHttpRequest object. You don't need to completely master it, but you should have at least a vague idea of what it does and how it works, because most Ajax frameworks are built on top of the XHR object. If you have an understanding of what the framework or library is doing for you under the covers, you'll be better equipped to handle problems when they arise.

To get started with Ajax, do a small example like validation or something like that. Doing so will give you a feel for how Ajax interactions work and behave, and once you have that you can move to bigger and better things.
If the select tag is a single select tag, can't you just access the select tag's value? I think this will report the value of whatever option is selected.... I think.
Try something like this for the onunload event:

Ajax and JSF are complimentary to each other. In fact, I think Sun has released quite a few Ajax-enabled JSF components.
You can try capturing the window.onclose event or the document.onunload event. I've tried these before and have somewhat uneven results, so try it in your environment.
Ajax works just fine over SSL. Really, under the covers, an Ajax request is just like any other HTTP/HTTPS request sent by the browser. The only difference is that (usually) an Ajax request is asynchronous and the browser doesn't block while it waits for the server to respond.
I'm sorry to hear that you're disappointed with the book.

From our experience, we've found that the best way to learn a new concept is to really focus on the core concepts and ensure that those concepts are well developed and presented. We've found that once the reader has completely mastered the core concepts, more advanced concepts become rather easy and often require little explanation.

We try to stay away from complex examples that only briefly mention the core concepts. We've all experienced the scenario where we've been trying to learn a new topic, and once we "get it" or "the light bulb comes on" the topic seems much easier. We've found that the fastest way to "get it" is to completely master the core concepts first.

What suggestions do you have for making the book better? Since the Java landscape is so big we wanted to expose readers to the most popular Ajax concepts and how they relate to the most popular frameworks.
The book covers a whole bunch of Ajax related aspects. Yes, we do discuss integrating Ajax into various frameworks, incluing Struts, Tapestry, JSF, and Spring.
I know this sounds like a cop-out, but the answer really depends on you and your environment. For example, Dojo and Prototype provide many similar features but they're often accessed or invoked differently, so you'll have to decide which style you prefer. DWR is another powerful tool, but while it does a great job of abstracting the connection plumbing and type conversions between JavaScript and Java, it doesn't have particularly powerful support for updating the DOM, like Taconite does.

The bottom line is there is a lot to choose from. Search the web for some examples on each one you're considering and take a look at features, coding style, and other things that might influence your decision.
My favorite to use with Struts is Taconite ( although clearly I'm biased since I'm the Taconite lead developer. Taconite integrates well with Struts because you can use JSPs to construct the Taconite response XML, which is mostly just XHTML embedded within some Taconite-specific XML tags.

Struts works well with most Ajax libraries. DWR, Prototype, and others are sure to work with Struts, so it mostly comes down to which framework best fits your coding style.
Ajax is best used when you want to updated small parts of the web page without forcing the user to wait through an entire refresh of the page. If most of the page needs to change then you're better off rebuilding the entire page.

I'm sure there are other rules, but this is a good one that applies in most situations.
If you're already familiar with basic web concepts and Java then you should be able to delve right into this book. Otherwise, may I humbly suggest our first book, "Foundations of Ajax," as a good Ajax primer:
Hi Wayne,

We would have liked to included a blurb about Google Web Toolkit but it wasn't introduced until we were too far into the production process. It's one of the sad realities of authoring.
Yeah, I thought we were crazy too! I just keep telling myself that having a life is overrated.... right?!

This one was a bit easier because we've been through the grind before and most of the writing was done over the winter rather than in the summer like the first time around. Staying inside during Minnesota winters doesn't take too much convincing!
One thing to note is that while IE 7 exposes XMLHttpRequest as a native JavaScript object, under the covers it appears that it is still implemented as an ActiveX control. Because of this, we apparently cannot do things like dynamically adding your own properties to an instance of the XHR object like we can to "pure" JavaScript objects.