[ https://issues.apache.org/jira/browse/MYFACES-1891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619363#action_12619363 ]
Leonardo Uribe commented on MYFACES-1891: ----------------------------------------- Suppose this scenario <h:form id="form"> <h:commandButton value="#{hideShowBean.hidden? 'Show' : 'Hide'}" action="#{hideShowBean.toggleHideShow}" immediate="true" /> <t:div id="hideableBlock" rendered="#{!hideShowBean.hidden}"> <div><h:selectOneRadio id="selectOneRadio" value="#{hideShowBean.property}"> <f:selectItem itemLabel="Option Z" itemValue="" /> <f:selectItem itemLabel="Option A" itemValue="1" /> <f:selectItem itemLabel="Option B" itemValue="2" /> <f:selectItem itemLabel="Option C" itemValue="3" /> </h:selectOneRadio></div> <div><h:inputText id="inputText" required="true" /></div> </t:div> <h:messages /> </h:form> According to the spec (see MYFACES-1759), itemValue="" is equivalent to null, so when you hide and show several times, the result should be the same (Option Z selected). To be according to the spec, on myfaces core 1.2 RendererUtils.NOTHING should be removed and used null instead. But on myfaces core 1.1 this spec does not enforce us, so to remain compatibility this solution is acceptable. But we need a patch against 1.1 > ClassCastException in converter when Hiding / Showing unselected > selectOneRadio > ------------------------------------------------------------------------------- > > Key: MYFACES-1891 > URL: https://issues.apache.org/jira/browse/MYFACES-1891 > Project: MyFaces Core > Issue Type: Bug > Affects Versions: 1.2.3 > Environment: MyFaces 1.2.3, Spring WebFlow 2.0.2, RichFaces 3.2.1, > Tomahawk 1.1.6, Facelets 1.1.15.B1, Tomcat 6.0.16 > Reporter: Patrick Schmidt > Attachments: example.zip, RendererUtils.patch > > > See the attached example. > When the block with the selectOneRadio ist shown, then hidden and then shown > again a ClassCastException occurs in the Converter. The selectOneRadio has as > submittedValue org.apache.myfaces.shared_impl.renderkit.RendererUtils$1, for > which the conversion is done. > javax.faces.FacesException: Exception while calling encodeEnd on component : > {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: > /WEB-INF/pages/schnellerfassung/dea/dea.xhtml][Class: > javax.faces.component.html.HtmlForm,Id: form][Class: > org.apache.myfaces.custom.div.Div,Id: hideableBlock][Class: > javax.faces.component.html.HtmlSelectOneRadio,Id: selectOneRadio]} > at > javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:610) > at > org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:286) > at > org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262) > at > org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:284) > at > org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262) > at > org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:284) > at > org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:125) > at > org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68) > at > org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116) > at > org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:123) > at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:673) > at > org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:544) > at javax.faces.component.UIComponent.encodeAll(UIComponent.java:239) > at > com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592) > at > org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108) > at > org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:189) > at org.springframework.faces.webflow.JsfView.render(JsfView.java:92) > at > org.springframework.webflow.engine.ViewState.render(ViewState.java:240) > at > org.springframework.webflow.engine.ViewState.resume(ViewState.java:199) > at org.springframework.webflow.engine.Flow.resume(Flow.java:535) > at > org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:261) > at > org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:153) > at > org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:173) > at > org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:172) > at > org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) > at > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875) > at > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809) > at > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) > at > org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > com.metzler.ec.web.filter.RendererFilter.doFilter(RendererFilter.java:183) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154) > at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260) > at > org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366) > at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359) > at > org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) > at > org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) > at > org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101) > at > org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) > at > org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105) > at > org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) > at > org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116) > at > org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) > at > org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91) > at > org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) > at > org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:268) > at > org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) > at > org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:268) > at > org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) > at > org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:87) > at > org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) > at > org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:61) > at > org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) > at > org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:229) > at > org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) > at > org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) > at > org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174) > at > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) > at > org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) > at java.lang.Thread.run(Thread.java:595) > Caused by: javax.faces.convert.ConverterException: > java.lang.ClassCastException: > org.apache.myfaces.shared_impl.renderkit.RendererUtils$1 > at > javax.faces.convert.IntegerConverter.getAsString(IntegerConverter.java:85) > at > org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:628) > at > org.apache.myfaces.shared_impl.renderkit.html.HtmlRadioRendererBase.encodeEnd(HtmlRadioRendererBase.java:91) > at > javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:607) > ... 87 more > Caused by: java.lang.ClassCastException: > org.apache.myfaces.shared_impl.renderkit.RendererUtils$1 > at > javax.faces.convert.IntegerConverter.getAsString(IntegerConverter.java:81) > ... 90 more -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.