hi. i have developped a JSF - I have FacesConverter  for selectOneMenu

Into my code the FacesCOnverter are annotated for example :


 @FacesConverter(forClass=Address.class)

// this converter it is for select a AddresEntity from selectOneMenu ,
,
 public static class AddressControllerConverter implements Converter {

        public Object getAsObject(FacesContext facesContext, UIComponent
component, String value) {
            if (value == null || value.length() == 0) {
                return null;
            }
            AddressController controller =
(AddressController)facesContext.getApplication().getELResolver().
                    getValue(facesContext.getELContext(), null,
"addressController");
            return controller.ejbFacade.find(getKey(value));
        }

        java.lang.Integer getKey(String value) {
            java.lang.Integer key;
            key = Integer.valueOf(value);
            return key;
        }

        String getStringKey(java.lang.Integer value) {
            StringBuffer sb = new StringBuffer();
            sb.append(value);
            return sb.toString();
        }

        public String getAsString(FacesContext facesContext, UIComponent
component, Object object) {
            if (object == null) {
                return null;
            }
            if (object instanceof Address) {
                Address o = (Address) object;
                return getStringKey(o.getAddressId());
            } else {
                throw new IllegalArgumentException("object " + object + " is
of type " + object.getClass().getName() + "; expected type:
"+AddressController.class.getName());
            }
        }

    }

----------
If i deploy into glassfsih with mojarra it work .
But IF i deploy into TOMEE with myfaces i get:

An Error Occurred:
object is of type java.lang.String; expected type: jsf.ClientController

viewId=/address/Create.xhtml
location=E:\documenti_mauro\progetti_con_smith\rifattopertomee\ConsultingAgency-master\build\web\address\Create.xhtml
phaseId=RENDER_RESPONSE(6)

Caused by:
java.lang.IllegalArgumentException - object is of type java.lang.String;
expected type: jsf.ClientController
at
jsf.ClientController$ClientControllerConverter.getAsString(ClientController.java:271)

-----------

why not work with myfaces and work with mojarra?




--
View this message in context: 
http://myfaces.10567.n7.nabble.com/FAcesCOnverter-forClass-Address-class-not-work-int-omyfaces-tp117069.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to