I added an Ajax section to my JSF 2.0 tutorial at http://www.coreservlets.com/JSF-Tutorial/jsf2/
I would love feedback from beginners (is it understandable?) and experts (what errors and important omissions did I make?) alike.
You can post here or email me at email@example.com.
thanks and great job.
I'm a JSF beginner, your tutorials are clear and useful. Thanks.
I am a veteran java developer, but new to jsf. These tutorials are awesome. They have been a huge help. Being able to import a working eclipse project is a great idea and makes things so much easier to understand since I don't have to worry about whether or not I set something up correctly.
There's a lot to comment on here.
First, I've got my own slides up on SlideShare:
I meant to put a CreativeCommons on them - please feel free to use them, I'll update them with the appropriate license sometime soon.
Now, some comments:
onevent (and onerror) is for client side event handling - "side effects" isn't how I'd say it, though I suppose that's mostly true.
Flash is mostly used for video display. Most of the folks I've met who've tried to use it for non-media purposes would rather gouge their eyes out with a fork than do that again.
You don't have to choose between client side frameworks like jQuery or Dojo and JSF's Ajax libraries - they should work together, with the important exception of the Ajax calls.
for render and execute, be sure to cover the UIComponent.findComponent syntax for ID, and note how they're different than the rendered client side ID's. (For instance, prependId=false doesn't get rid of the prepended ID in the tree, only in the page). Yes, this is confusing, but you can get a lot of extra expressive power because of this. Your prependId example works, but not because of why you think it does :-(
onerror is much more important than onevent - for example, you could show handling a view expired exception gracefully... onevent has a more limited utility for things like busy status indicators (see my blog for an example).
Rather than using outputText to dynamically generate tags, the new Composite Component feature is probably more friendly to that use case. And yes, it should work with Ajax too, if you write it correctly.
Lastly, you may wish to dive into resources, and the jsf.ajax.request function. But that will make the slidedeck much longer.
Woo hoo! Thanks for the [b]really [/b]great feedback. I am teaching a course this week (not on JSF), but I will try to incorporate your comments as soon as I can.
Gouge their eyes out with a fork, eh? :-)
If I can add two comments to Jim's,
I would be clearer that the Ajax update doesn't replace the element's value, it replaces the entire DOM node that carries the element's ID.
To put Jim's explanation in simple terms, I have never used prependId, and I never put formname: in my render and execute element names, and it always finds my components.
Nice tutorial, I learned a few things.
Good suggestions; thanks. And clearly, I didn't properly understand prependId.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.