myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ali Abdel-Aziz Ali" <robinhoo.2...@gmail.com>
Subject Fwd: Converter strange behaviour
Date Wed, 26 Mar 2008 11:33:39 GMT
Hi All,

I have strange behavior in my Custom Converter

I have created new Converter called LongConverter and I have registered it
in faces-Config.xml
and I have used it inside selectOneMenu component as follows

<t:saveState value="#{applicationAddBean.selectedId}" />

                         <t:selectOneMenu id="applicationTypes"
                                             value="#{
applicationAddBean.selectedId}"
                                             onchange="submit();">
                                <f:selectItem itemLabel="#{
globalResource.selectItemLabel}"
                                              itemValue="#{
globalResource.selectItemValue}"/>
                                <t:selectItems value="#{
applicationAddBean.procedures}"
                                                      var="procedureVersion"

                                                      itemLabel="#{
procedureVersion.versionName}"
                                                      itemValue="#{
procedureVersion.id}" />
                                <f:converter converterId="LongConverter" />
                            </t:selectOneMenu>


but when I select an item it first call the setSelectedId(Long id) which
passes null to it; then it call getAsObject method inside LongConverter
class

                        public Object getAsObject(FacesContext facesContext,

                                                               UIComponent
uIComponent,
                                                               String
string) throws ConverterException {
                                 return Long.valueOf(string);
                        }


and when I remove the save state line it didn't fire the setSelectedId
method at all just inoke the getAsObject method

Can any body help?


Thanks in advance.

-- 
Ali Abdel-Aziz
http://www.aliabdelaziz.com

Mime
View raw message