Jim Driscoll

Subscribe to Jim Driscoll: eMailAlertsEmail Alerts
Get Jim Driscoll: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Top Stories by Jim Driscoll

Even though it's considered bad practice, it's often handy to eval code in JavaScript.  And in my case, it was simply necessary, since the JSF specification requires eval of scripts. And it's also necessary to execute those evaluated scripts in the global scope. It's not as easy as it first looks. For our first naive implementation, we'd simply used eval(src) in our first pass at the implementation. This is utterly wrong, and to understand why, you'll need to understand scopes. JavaScript has what you can think of as two different scopes - function scope, where you're executing something in the context of a function, and global scope, where you're executing something in a global context - for instance, if I say var j = 1; within a function's scope, then the variable j is set to 1 within that function. If I say the same expression, var j = 1 within the global scop... (more)

JSF 2, Custom Java Components, and AJAX Behaviors

Unlike most of my blog posts, where I try to describe the easiest possible way to do things, in this posting, I'll instead go over a Java-based custom JSF component that responds to the Ajax tag. The reason being that there simply aren't any examples out there of how to do this, and at least two people have expressed interest in finding exactly out how this is done. I'd advise anyone considering doing this to make really sure that you can't do the same thing in a Composite Component (you usually can), but sometimes, a Java-based custom JSF component is going to be required. We'r... (more)

Bridging to Open Ajax

The Open Ajax Alliance is a standards organization with the mission of ensuring interoperability within Web based Ajaxified applications. One of their standards relates to intercomponent communication - the ability to subscribe and publish messages which can then be picked up by code written by other authors. Please note that if you don't have an interest in Open Ajax, this post may not be especially illuminating - I've talked about the addOnEvent function before, even recently. To write an Open Ajax application, you need to subscribe to events, much like in JSF 2, by register... (more)

AJAX Tag Events and Listeners

Today we're going to talk about two features of JSF 2.0's f:ajax tag: the event attribute and the listener attribute. The use of both of these is really, really simple - so I'll just briefly cover the basics, and then launch directly into the sample code. The "event" attribute of the ajax tag indicates which event to use to trigger the ajax request. There are any number of possible events allowed: You can use the standard browser DOM events (like click, change, keyup, etc. You can also use two special event values - action and valueChange. These two special values correspond to t... (more)

An (almost) Comprehensive List of Web Components

In talking with Andy Schwartz before our recent talk together at Oracle Open World, Andy mentioned that he'd like to see some new components make it in to JSF 2.1. I'd like to see that too - but what new components? To aid the discussion, I thought it might be handy to make up a list of components that I think would be handy for JSF - but please, don't take this as an endorsement of any particular component for inclusion into the spec. At best, I can see us adding only a handful, perhaps 3 or so. Still, once started, this kind of project becomes it's own end - so I decided it mi... (more)