quality@glassfish.java.net

JSF 1.2 Converters stop working in JSF 2.0

From: Wouter van Reeven <wouter_at_van.reeven.nl>
Date: Sat, 31 Oct 2009 13:33:43 +0100

Hi all,


In the past weeks I have been preparing a presentation for the Dutch
Java conference JFall 2009. In the presentation I will do a live demo
migrating a JEE5 Web application to JEE6.

In the JEE5 web app I have two Converters to convert an entry from a
drop down list to an Object. They work perfectly ok. However, I have
some troubles getting them to work in JEE6.

I have removed my faces-config as is possible with JEE6. Instead I have
annotated my converters like this

@FacesConverter("constellationConverter")
public class ConstellationConverter implements Converter {
    <code deleted>
}

In my xhtml file I have lines like this

<h:outputLabel for="constellation" value="Constellation"/>
<h:selectOneMenu id="constellation" value="#{jf2009mb.newSac.constellation}" converter="constellationConverter">
    <f:selectItems value="#{jf2009mb.constellations}"/>
</h:selectOneMenu>

If I omit the converter="constellationConverter" bit I get conversion
errors. However, the constellation member in the newSac object always is
null! There is another member in that same class that also needs a
converter and it also always is null.

Would anyone know what I am doing wrong?


Thanks, Wouter

-- 
Veel shit is mest voor de toekomst.
[Unknown Source]
Skype: wvreeven
Facebook: wvreeven
Twitter: wvreeven