Bonjour,

C'est du chinois pour moi, j'ai crée un converter suite à un problème sur une page utilisant un selectOneMenu
dans un p:wizard, il ne fonctionne pas mais en plus, il crée des effets de bord.
dans un formulaire autre j'avais un appel ajax avec redirection sans converter ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
<h:panelGrid columns="2" columnClasses="column" cellpadding="5">
                <h:outputText value="#{msg['choix.textselect']}"/>
                <p:inplace label="-- Degré ?">
                    <p:selectOneMenu value="#{ChoiceManagedBean.degreitems}">
                        <f:selectItem itemValue="choice" itemLabel="-- Degré ?" />
                        <f:selectItem itemValue="degre1" itemLabel="Degré 1" />
                        <f:selectItem itemValue="degre2" itemLabel="Degré 2" />
                        <f:ajax event="change" listener="#{ChoiceManagedBean.changedegre}"/>
                    </h:selectOneMenu>
                </p:inplace>
            </h:panelGrid>
Mais depuis que j'ai rajouté @FacesConverter, sur un objet de ce type, il est appelé par défaut sur toutes les pages comportant
une selectOneMenu, et dans mon exemple, je ne l'utilise pas ?????? mais je vois passer un appel
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
nfos:   END PHASE RENDER_RESPONSE 6
Infos:   END PHASE RENDER_RESPONSE 6
Infos:   START PHASE RENDER_RESPONSE 6
Infos:   START PHASE RESTORE_VIEW 1
Infos:   END PHASE RENDER_RESPONSE 6
Infos:   END PHASE RESTORE_VIEW 1
Infos:   START PHASE RENDER_RESPONSE 6
Infos:   END PHASE RENDER_RESPONSE 6
Infos:   START PHASE RESTORE_VIEW 1
Infos:   END PHASE RESTORE_VIEW 1
Infos:   START PHASE APPLY_REQUEST_VALUES 2
Infos:   END PHASE APPLY_REQUEST_VALUES 2
Infos:   START PHASE PROCESS_VALIDATIONS 3
Infos:   passage de value : deg1
Infos:   END PHASE PROCESS_VALIDATIONS 3
Infos:   START PHASE UPDATE_MODEL_VALUES 4
Infos:   END PHASE UPDATE_MODEL_VALUES 4
Infos:   START PHASE INVOKE_APPLICATION 5
Infos:   la question
Infos:   Enregistrement : null
Infos:   message erreur
Infos:   END PHASE INVOKE_APPLICATION 5
Infos:   START PHASE RENDER_RESPONSE 6
Infos:   END PHASE RENDER_RESPONSE 6
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
28
29
30
 
 
public class GenericSecuredConverter implements Converter, Serializable {
 
    private static final long serialVersionUID = 1L;
    private Types types;
    @EJB
    TypesFacadeLocal typeslocal;
 
    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        System.out.println("passage de value : "+ value);
         try {
            types = (Types) typeslocal.find(Long.decode(value));
        } catch (Exception e) {
            types = null;
        }
        return types;
    }
 
    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        System.out.println("Types.getAsString");
        if(!(value instanceof Types))
        {
            return null;
        }
        return String.valueOf(((Types) value).getCodeType());
    }
}