Facebook: Add Social Plugins

Facebook makes it fool proved to add social plugins to your website. Basically a thing done in minutes:

  1. Register your website as an application on facebook. This can be done at http://developers.facebook.com/setup/, the only thing required is a name and the site’s URL.
  2. Place a javascript onto every page you’re going to add social plugins. The javascript can be found at http://developers.facebook.com/docs/reference/javascript/. You only need to add your application-id as it has been created in step 1.
  3. The only thing left is to place a facebook-tag on each of the pages where you want to add the like-box, recommend-box or comment feature. For the like-button it’s as simple as: <fb:like></fb:like>.

Upgrade to JSF 2.x and Webflow 2.1.x

Generally, the upgrade could be easy, but still took me a while to get there. So here’s a summary of my changes to the existing project.

Update References (e.g. with Maven)

First, add the references to JSF 2.0 (in my case I used Apache MyFaces 2.x). With maven it looks like this:

Additionally (I think it might not be necessary) I upgraded to the latest facelets release (version 1.1.15):

Now it’s also time to upgrade the spring versions (you might also need to upgrade further dependencies such as Spring Security, Spring ORM etc. Make sure that at the end you don’t have any 2.x references left of any of your dependencies or sub dependencies:

And eventually the upgrade to Spring Webflow 2.1.x:

This was actually all to get it running again. However, see below some further information on troubleshooting.

Eclipse: JavaServer Faces Project Facet

First I had eclipse running with the Project Facet configured for JavaServer Faces 1.2. However, I was not able to add that for Faces 2.0, thus I removed it completely. Now I take care of the distribution of the faces-jars by myself via dependency to these libraries in the project itself (see maven configurations above).

If you forget the references to the faces libraries (or actually if they are not available to your application server), you’re most probably running into the following exception:
code>javax.faces.FacesException: Undefined component type javax.faces.ViewRoot

Recommended Reading