0

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)
mabi
  • 5,279
  • 2
  • 43
  • 78
mogiwara
  • 47
  • 1
  • 6
  • {GenericConverter} dosen't look like correct faces expression, also have you registered your convertor in faces-config.xml? – Adi Dec 17 '13 at 11:36
  • yes i declare it in my faces-config.xml LIke that GenericConverter com.daki.tms.util.GenericConverter request – mogiwara Dec 17 '13 at 12:32
  • sorry and last i find the problem its just a error in declaration i forget to met a # in my EL delcaration of generic converter thanks alot my friends :D – mogiwara Dec 17 '13 at 12:39

0 Answers0