Home » Author Archives: Phillip Webb

Author Archives: Phillip Webb

Spring & JSF integration: Exception Handling

jsf-logo

Most JSF developers will be familiar the “An Error Occurred” page that gets displayed when an unexpected exception is thrown somewhere their code. This page is really useful when developing but is not something you usually want for a production application. You generally have a couple of options when it comes to replacing this page with stock JSF; you can ...

Read More »

Spring & JSF integration: Select Items

jsf-logo

With JSF, to use comboboxes, listboxes and checkboxes, you need to be aware of the javax.faces.model.SelectItem class. A SelectItem represents a single selectable option; it contains both the information needed for rendering, and the value that should be bound if the item is selected. Most of the time SelectItems are constructed with a value and a label: new SelectItem(Title.MISS, "Miss"); ...

Read More »

Spring & JSF integration: Internationalization and Localization

jsf-logo

If you are working on a JSF application that is targeted to multiple languages, you may well be familiar with the <f:loadBundle> tag. Even if your application does not support internationalization using message bundles is still probably a good idea. Under the hood the <f:loadBundle> tag reads messages from a Java java.util.ResourceBundle and, whilst this will work, Spring developers often ...

Read More »

Spring & JSF integration: Converters

jsf-logo

When working with any web framework, you invariable run into the need to convert data input by the user from a String to some other type. Both Spring and JSF have converter strategies to deal with this, although they are really quite different in both their design and capabilities. Lets start by looking at Spring. Spring 3 introduced a whole ...

Read More »

Spring & JSF integration: Pagination

jsf-logo

When working with large datasets you often need to present data in a paged format. Pagination is an interesting problem because it tends to cut across all layers of your application, from the view tier though application services down to the raw calls to your database. When it comes to fetching paged data there are some pretty good solutions available. ...

Read More »

Spring & JSF integration: Dynamic Navigation

jsf-logo

Often your JSF application will need to move beyond basic static navigation and start to make dynamic navigation decisions. For example, you may want to redirect users based on their age. Most JSF tutorials recommend that dynamic navigation is implemented by binding the action attribute of a command to a backing bean: <h:commandButton action="#{bean.actionBasedOnAge}"/> public String actionBasedOnAge() { if(age &lt; ...

Read More »

DBUnit, Spring and Annotations for Database testing

dbunit-logo

If you have ever tried writing database tests in Java you might have come across DBUnit. DBUnit allows you to setup and teardown your database so that it contains consistent rows that you can write tests against. You usually specify the rows that you want DBUnit to insert by writing a simple XML document, for example:         ...

Read More »

Integrating Spring & JavaServer Faces : Improved Templating

jsf-logo

With the release of version 2.0 Facelet templating became a core part of the JSF specification. Using <ui:composition> and <ui:decorate> tags it becomes pretty easy to build up complicated pages whilst still keeping your mark-up clean. Templates are particularly useful when creating HTML forms but, unfortunately, do tend to cause repetition in your xhtml files, breaking the DRY (Don’t Repeat ...

Read More »

Spring & JSF integration: MVC Nuts and Bolts

jsf-logo

I have attempted to integrate JSF with Spring MVC in the past, and whilst my first attempt worked, it was far from ideal. This time around I decided to take a few key decisions to help focus my efforts: Drop backwards compatibility. There is just too much work involved with supporting JSF 1.2 and too much good stuff coming up ...

Read More »

Spring & JSF integration: Navigation

jsf-logo

This is the first in what I hope will be a series of blogs about my efforts to provide deep integration between Spring and JavaServer Faces. Everything mentioned here is a “work in progress” so if you checkout the code please be aware that it is a moving target; expect some rough edges and don’t be surprised if it’s sometimes ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.