1 Reply Latest reply on Sep 18, 2008 4:00 PM by Francisco Jose Peredo Noguez

    selectItems noSelectionLabel broken for Map

    Francisco Jose Peredo Noguez Master

      Hi!
      I am working with Seam 2.0.2.SP1, on plain Tomcat 6.0.18, with JDK 1.6.u7


      This works fine:


      <h:selectOneMenu name="selectName" value="#{controller.mapProperty['key']}" >
      <s:selectItems  value="#{controller.sourceList}" var="item" label="#{item['label']}"/>                                                                            
      </h:selectOneMenu>
      



      This crashes (the difference? I added a noSelectionLabel):


      <h:selectOneMenu name="selectName" value="#{controller.mapProperty['key']}" >
      <s:selectItems noSelectionLabel="Please select item"  value="#{controller.sourceList}" var="item" label="#{item['label']}"/>                                                                              
      </h:selectOneMenu>
      



      Stack trace:


      java.lang.NullPointerException: Argument Error: Parameter targetClass is null
              at com.sun.faces.application.ApplicationImpl.createConverter(ApplicationImpl.java:740)
              at org.jboss.seam.jsf.SeamApplication.createConverter(SeamApplication.java:126)
              at org.jboss.seam.ui.converter.ConverterChain.<init>(ConverterChain.java:88)
              at org.jboss.seam.ui.component.UISelectItems.noSelectionLabel(UISelectItems.java:225)
              at org.jboss.seam.ui.component.UISelectItems.getValue(UISelectItems.java:149)
              at com.sun.faces.renderkit.RenderKitUtils.getSelectItems(RenderKitUtils.java:323)
              at com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:675)
              at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:793)
              at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:335)
              at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:896)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
              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:216)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
              at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
              at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
              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:191)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
              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:845)
              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:619)
      



      I think that the problem is that it can not determine the rigth type for the #{controller.mapProperty['key']} expression since it an entry in a java.util.Map instead of a property in a bean.


      Should I submit a JIRA?


        • 1. Re: selectItems noSelectionLabel broken for Map
          Francisco Jose Peredo Noguez Master

          Well, since noboy answered, I created the JIRA anyway: JBSEAM-3430 .


          BTW, the code:


          <h:selectOneMenu name="selectName" value="#{controller.mapProperty['key']}" >
          <s:selectItems  value="#{controller.sourceList}" var="item" label="#{item['label']}"/>                                                                            
          </h:selectOneMenu>
          



          should put the selected java.util.Map in to #{controller.mapProperty['key']} but it puts a the toString() instead. I am guessing it is because I am not using a custom converter.


          Am I right?