Hi All,
I am trying to understand if the following scenario is a proper behavior of
JSF:
I have 2 components:
<h:selectOneRadio id="source"
converter="CampaignSourceConverter" value="#{cmp_new.cmpCampaign.source}"
onclick="switchSource(getSelectedSource());" disabled="#{not empty
cmp_new.cmpCampaign.campaignId}">
<f:selectItems value="#{cmp_new.sources}"/>
</h:selectOneRadio>
<t:selectOneMenu id="advertiser"
value="#{cmp_new.cmpCampaign.pubAdvertiser}" onchange="submit();"
valueChangeListener="#{cmp_new.advertiserChanged}" immediate="true"
converter="AdvertiserConverter"
styleClass="mformsel" style="width:240px;">
<f:selectItems value="#{cmp_new.pubAdvertisers}"/>
</t:selectOneMenu>
When I change the drop down (the second component), I am getting
ClassCastException:
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to
com.todacell.ui.model.persistence.StringValuedEnum
at
com.todacell.ui.view.converter.CampaignSourceConverter.getAsString(CampaignSourceConverter.java:17)
at
org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:630)
at
org.apache.myfaces.shared_impl.renderkit.html.HtmlRadioRendererBase.encodeEnd(HtmlRadioRendererBase.java:91)
at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:624)
... 37 more
It seems like when using immediate="true" caused the
"CampaignSourceConverter" converter to receive the value as string rather
that the object.
Is it a proper behavior?
Thanks,
Guy.