Jim Driscoll

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

Top Stories by Jim Driscoll

In this blog, I'll examine two different ways to create a poll component with JSF 2, and in doing so, we'll look briefly at the two different ways that you specify id's in the two JSF 2 Ajax APIs. Today, I'd like to take a look at two different ways to create a poll component. Poll components are a way to periodically update a page with new information. We'll take a look at examples of these in a second, but first, a caveat: I've assumed throughout my blogs on Ajax components in JSF that you have at least a passing familiarity with JavaScript. This post assumes a bit more knowledge of JavaScript than some other posts. I'll try to explain what I'm doing as I go along, but if you find yourself mystified by closures, I'd like to suggest the book JavaScript: The Good Parts. It's a wonderful book, and quite short. Check it out. With that out of the way, here's how you'd ... (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)

A Quick Introduction to the Groovy Language (Part 1)

Before I start talking about using Groovy's capabilities to create a DSL (mostly in Java), let's take a few minutes to go over what Groovy is. Groovy is a general purpose scripting language which runs on the JVM, and can largely be viewed as a superset of Java.  Take the following program: public class Hello { String name; public void sayHello() { System.out.println("Hello "+getName()+"!"); } public void setName(String name) { this.name = name; } public String getName() { return name; } public static void main(String[] args) { Hello hello = new Hello(); hello.setName("world"); hel... (more)

Eval JavaScript in a Global Context

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 executin... (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)