Converter selectOneMenu jsf 1.2

917 Views Asked by At

I have a problem when i call my Converter in page jsp

<f:view> 
    <a4j:keepAlive beanName="GenericConverter" />

    <h:selectOneMenu value="#{Bean.var}" id="cl" converter="{GenericConverter}">
        <f:selectItems value="#{bean.list}" />
    </h:selectOneMenu> 

This list contains an object comme value and String label after i want to return an object and work with it my Bean

Here is my converter

public class GenericConverter implements Converter, Serializable{
    private static final long serialVersionUID = 1L;
    private Map <UUID, Object> temporaryStore = new HashMap <UUID, Object> ();

    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        if (value==null || value.isEmpty()){
            return null;
        }

        return temporaryStore.get(UUID.fromString(value));
    }


    public String getAsString(FacesContext context, UIComponent component, Object value) {              
        UUID id = UUID.randomUUID(); 
        if (value==null) {
            value = null;
        }

        temporaryStore.put(id, value);
        return id.toString();
    }
}

i work with jsf 1.2 and richefaces my bean converter is a bean request i try many of solution in google or in this site but i have another problem my problem is

> déc. 17, 2013 11:15:28 AM com.sun.faces.application.ApplicationImpl createConverter
SEVERE: JSF1006: Cannot instantiate converter of type {GenericConverter}
déc. 17, 2013 11:15:28 AM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: "Servlet.service()" pour la servlet jsp a lancé une exception
java.lang.NumberFormatException: For input string: "GenericConverter"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
0

There are 0 best solutions below