[
https://issues.apache.org/jira/browse/MYFACES-1891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12620919#action_12620919
]
Paul Rivera commented on MYFACES-1891:
--------------------------------------
Hi Leonardo,
I tested your scenario with the myfaces jars prior to my patch (Myfaces 1.2.2).
This was the behavior:
Option Z was selected by default.
Pressing hide/show does not throw exception and will still select Option Z.
If I select option A, B, or C and then press hide/show, it will still be the
same button selected once the page loads.
I also testd it with the patched jars (MyFaces 1.2.4-SNAPSHOT). Same behavior
as above.
I also tested for the case where your SelectItem gets created in your bean like:
new SelectItem(null, "Null SelectItem", "This is a null select item.")
The outcome is the same as your scenario. The item with the null value gets
selected by default. When this selectItem gets rendered, the value attribute
of its input tag is equal to "".
I think there's nothing wrong with your scenario. Unless this is not the
desired behavior.
As for JSF 1.2 Spec item #69:
69 - Permit the passing of a null value to SelectItem.setValue().
RenderUtils.NOTHING only gets assigned to the value attribute of your
UISelectOne or UISelectMany(in in the example given, it is assigned to
HtmlRadioRenderer). I believe it does not get assigned to the value of
SelectItem.
I think that the only way to have the value of your SelectItem to null is by
creating it this way:
new SelectItem(null, "Null SelectItem", "This is a null select item.")
Because if you use the tag similar to this:
<f:selectItem itemLabel="Option Z" itemValue="" />
it will set the value of your SelectItem to "".
In either case, during the update values phase, bean.property will be set to 0
and not null. Is the JSF 1.2 spec trying to say that whenever a SelectItem of
value equal to null gets selected, the backing bean property should be null
instead of 0?
Also, the patch I provided here before was for RendererUtils which belongs to
myfaces-shared-core. myfaces-shared-core is shared between myfaces 1.1 and 1.2
right? Or is there a way to modify RendererUtils without affecting myfaces 1.2
if we are to patch myfaces 1.1 only?
> 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.