Bonjour,

J'ai l'erreur suivante dans un converter personnalisé, mais pourquoi ?
Mon but est de mettre en majuscule une traduction issu d'un fichier propertie, mais uniquement dans certains cas, et donc d'éviter deux lignes de traductions.

<f:converter> Parent not an instance of ValueHolder: javax.faces.component.html.HtmlCommandButton@1

Le .xhtml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
<ui:composition template="/layout/template.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
 
 
<h:commandButton action="#{reportBean.reportAction}"
                                     value="#{msg['createreport']}">
                                     <f:converter converterId="upperCaseFirstLetterConverter" />
                    </h:commandButton>
Le code java
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
@FacesConverter("upperCaseFirstLetterConverter")
public class UpperCaseFirstLetterConverter implements Converter {
 
    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        return value.toUpperCase();
    }
 
 
    @Override
    public String getAsString(FacesContext context, UIComponent component, Object modelValue) {
        if (modelValue == null || ((String) modelValue).isEmpty()) {
            return null;
        }
 
        String string = (String) modelValue;
        System.out.println("converter:"+string);
        System.out.println("converterb:"+new StringBuilder()
        .append(Character.toTitleCase(string.charAt(0)))
        .append(string.substring(1)).toString());
        return new StringBuilder()
            .append(Character.toTitleCase(string.charAt(0)))
            .append(string.substring(1))
            .toString();
    }
}

Ou est mon erreur ?
Merci d'avance
Phil