Skip to main content

JSF 2.0: Ajax Section of JSF2 Tutorial Now Available

7 replies [Last post]
martyhall
Offline
Joined: 2009-08-19
Points: 0

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 hall@coreservlets.com.

Cheers-

- Marty

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
leader1
Offline
Joined: 2011-05-15
Points: 0

thanks and great job.

requiem
Offline
Joined: 2005-12-09
Points: 0

I'm a JSF beginner, your tutorials are clear and useful. Thanks.

kblbdad
Offline
Joined: 2003-06-16
Points: 0

Marty,

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.

Thanks,
Jim

driscoll
Offline
Joined: 2003-06-06
Points: 0

There's a lot to comment on here.

First, I've got my own slides up on SlideShare:

http://www.slideshare.net/jimdriscoll/jsf-2-and-ajax

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 f:ajax event, you could use the term "DOM Event" instead of "JavaScript event". It's more accurate, I think, and less ambiguous.

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.

Jim

martyhall
Offline
Joined: 2009-08-19
Points: 0

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? :-)

Cheers-

- Marty
http://www.coreservlets.com

judys
Offline
Joined: 2009-07-23
Points: 0

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.

martyhall
Offline
Joined: 2009-08-19
Points: 0

Good suggestions; thanks. And clearly, I didn't properly understand prependId.

Much appreciated-

- Marty
http://www.coreservlets.com