14 Replies Latest reply on Apr 25, 2007 11:58 AM by Christopher no

    <s:selectItems> problem

    Christopher no Newbie

      Hi,

      I've got problem with <s:selectItems> control. I try to populate it with the list from my Dictionary class:

      @Name("dictionary")
      public class Dictionary implements Serializable{
      
       List<SelectItem> sexList;
      
       public Dictionary(){
      
       sexList = new ArrayList<SelectItem>();
      
       sexList.add(new SelectItem('F', ResourceBundle.instance().getString("sexFemale")));
       sexList.add(new SelectItem('M', ResourceBundle.instance().getString("sexMale")));
      
      
      
      
       employedList = new ArrayList<SelectItem>();
       employedList.add(new SelectItem("0", ResourceBundle.instance().getString("labelYes")) );
       employedList.add(new SelectItem("1", ResourceBundle.instance().getString("labelNo")) );
      
      
      
       }
      
      
       public Dictionary createInstance(){
       Dictionary dictionary = new Dictionary();
       return dictionary;
       }
      
      
      
       public List<SelectItem> getSexList() {
       return sexList;
       }
      
       public void setSexList(List<SelectItem> sexList) {
       this.sexList = sexList;
       }
      
      
      
      }
      
      


      my facelet contains the following code:

      ...
      <h:selectOneMenu value="#{profileHome.instance.sexFlag}">
       <s:selectItems value="#{dictionary.sexList}" var="sex" label="#{sex.label}" />
      </h:selectOneMenu>
      ...
      

      When the page is rendered I get the error:
      23:22:14,687 ERROR [STDERR] 2007-04-24 23:22:14 com.sun.facelets.FaceletViewHandler handleRenderException
      SEVERE: Error Rendering View[/specialist/spec_profile_edit.xhtml]
      javax.faces.convert.ConverterException: java.lang.ClassCastException: javax.faces.model.SelectItem
       at javax.faces.convert.CharacterConverter.getAsString(CharacterConverter.java:74)
       at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:544)
       at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:555)
       at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderSelectOptions(HtmlRendererUtils.java:398)
       at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:298)
       at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:252)
       at org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:54)
       at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
       at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:442)
       at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:216)
       at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:98)
       at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:252)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
       at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:221)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.ClassCastException: javax.faces.model.SelectItem
       at javax.faces.convert.CharacterConverter.getAsString(CharacterConverter.java:70)
      

      When I add a standard converter:

      ...
      <h:selectOneMenu value="#{profileHome.instance.sexFlag}" converter="Character">
       <s:selectItems value="#{dictionary.sexList}" var="sex" label="#{sex.label}" />
      </h:selectOneMenu>
      ...
      

      I get the error:
      23:23:45,765 ERROR [ApplicationImpl] Could not instantiate converter null
      java.lang.NullPointerException
       at org.apache.myfaces.application.ApplicationImpl.createConverter(ApplicationImpl.java:462)
       at org.jboss.seam.jsf.SeamApplication11.createConverter(SeamApplication11.java:92)
       at com.sun.facelets.tag.jsf.ValueHolderRule$LiteralConverterMetadata.applyMetadata(ValueHolderRule.java:45)
       at com.sun.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:36)
       at com.sun.facelets.tag.MetaTagHandler.setAttributes(MetaTagHandler.java:62)
       at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:144)
       at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
       at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
       at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
       at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
       at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
       at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
       at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
       at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
       at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
       at com.sun.facelets.tag.ui.DefineHandler.apply(DefineHandler.java:58)
       at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:128)
       at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:306)
       at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:279)
       at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
       at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
       at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
       at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
       at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
       at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
       at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
       at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
       at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
       at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
       at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
       at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
       at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
       at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:503)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:546)
       at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:221)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      


      And when I use <f:selectItems>:
      ...
      <h:selectOneMenu value="#{profileHome.instance.sexFlag}" >
       <f:selectItems value="#{dictionary.sexList}"/>
      </h:selectOneMenu>
      ...
      

      the page is rendered correctly.
      I don't know what I am doing wrong that <s:selectItems> doesn't work.

      Thanks in advance for any help.


      Best regards,
      jquery


        • 1. Re: <s:selectItems> problem
          Pete Muir Master

          s:selectItems expects a List rather than a List. Take a look at the ui example for some sample usage.

          • 2. Re: <s:selectItems> problem
            Saeed Iqbal Novice

             

            "petemuir" wrote:
            s:selectItems expects a List<Sex> rather than a List<SelectItem>. Take a look at the ui example for some sample usage.
            


            • 3. Re: <s:selectItems> problem
              Christopher no Newbie

              Hi,

              I've looked at ui example but I don't understand what kind of object Sex (in List) should be. Does it really must be an entity? Could you guys give me some lines of code to know what the right attitude is, please. I've read in documentation (p. 230 & 231) that <s:selectItems> creates a List from a List, Set, DataModel or Array. But List, Set, DataModel or Array of what kind of objects? And why they can't be SelectItem?

              Thanks,
              jquery

              • 4. Re: <s:selectItems> problem
                Pete Muir Master

                Nope, they don't need to be an entity. Without a converter they must be a List. If you want a List then just use f:selectItems. The reason for s:selectItems is to *not* put presentation code into your business layer.

                • 5. Re: <s:selectItems> problem
                  Christopher no Newbie

                  Ok, I understand the separation aspect of s:selectItems. And If they don't need to be an entity, so what else they can be. And why don't standard converters work (i.e Character as in above example - "Could not instantiate converter null java.lang.NullPointerException") with s:selectItems?

                  Thanks,
                  jquery

                  • 6. Re: <s:selectItems> problem
                    Pete Muir Master

                    There is no converter called Character in the JSF API that I know of. That NPE just means it couldn't create the converter.

                    They List can be of any type of object for which a converter exists. JSF has a number of converters e.g. date, currency, number. Seam adds an EntityConverter (for any entity) and an enumConverter.

                    • 7. Re: <s:selectItems> problem
                      Pete Muir Master

                      The id of the CharacterConverter is javax.faces.Character, the NPE is coming from myfaces, I suggest you ask them to replace it with a better exception :)

                      • 8. Re: <s:selectItems> problem
                        Christopher no Newbie

                        I've found in "Mastering Java Server Faces" p.283 that there is standard converter - "CharacterConverter" class, which has "Character" id. In JSF API I've found it too:
                        http://java.sun.com/javaee/javaserverfaces/1.2_MR1/docs/api/index.html

                        And as for NPE, what should I do to instantiate standard converter like Character or Integer? I've thought it's enough to include the following tag libraries

                        
                        html xmlns="http://www.w3.org/1999/xhtml"
                         xmlns:ui="http://java.sun.com/jsf/facelets"
                         
                         xmlns:h="http://java.sun.com/jsf/html"
                         xmlns:f="http://java.sun.com/jsf/core"
                        
                         xmlns:s="http://jboss.com/products/seam/taglib">
                        

                        in my facelet template. But it seems it's not all I should do.

                        Thanks,
                        jquery


                        • 9. Re: <s:selectItems> problem
                          Pete Muir Master

                          According to the link you posted (well actually this one as that's just a pointer to the api for JSF http://java.sun.com/javaee/javaserverfaces/1.2_MR1/docs/api/constant-values.html#javax.faces.convert.CharacterConverter.CONVERTER_ID)

                          the id is javax.faces.Character. I guess the book is wrong. Use the correct ID and your NPE will go away.

                          • 10. Re: <s:selectItems> problem
                            Christopher no Newbie

                            Yes, you're right the proper id is javax.faces.Character. NPE has gone away :). Thanks for that solution. Actually it doesn't work with s:selectItems (class cast exception). So if I'd like to implement custom converter for List how to return two values (value and label) in getAsString method for selectOneMenu?

                            Thanks,
                            jquery

                            • 11. Re: <s:selectItems> problem
                              Pete Muir Master

                              Post the exception stack trace.

                              So if I'd like to implement custom converter for List how to return two values (value and label) in getAsString method for selectOneMenu?


                              You can't, thats not what a converter does.

                              • 12. Re: <s:selectItems> problem
                                Christopher no Newbie

                                The stack trace is following

                                
                                javax.faces.convert.ConverterException: java.lang.ClassCastException: javax.faces.model.SelectItem
                                 at javax.faces.convert.CharacterConverter.getAsString(CharacterConverter.java:74)
                                 at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:544)
                                 at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:555)
                                 at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderSelectOptions(HtmlRendererUtils.java:398)
                                 at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:298)
                                 at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:252)
                                 at org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:54)
                                 at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
                                 at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:442)
                                 at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:216)
                                 at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:98)
                                 at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
                                 at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:252)
                                 at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
                                 at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
                                 at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
                                 at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
                                 at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
                                 at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:221)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
                                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                                 at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
                                 at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                Caused by: java.lang.ClassCastException: javax.faces.model.SelectItem
                                 at javax.faces.convert.CharacterConverter.getAsString(CharacterConverter.java:70)
                                 ... 56 more
                                
                                


                                ou can't, thats not what a converter does.

                                So I guess that in
                                public String getAsString(FacesContext context,
                                UIComponent component,
                                Object target)
                                

                                method, "target" represents only a value of selectItem in selectOneMenu which has to be converted into string?

                                Thanks.
                                jquery


                                • 13. Re: <s:selectItems> problem
                                  Pete Muir Master

                                  As I said, don't use s:selectItems if your backing bean is creating a List, use a f:selectItems.

                                  Yes, a converter is for the value, not the label.

                                  • 14. Re: <s:selectItems> problem
                                    Christopher no Newbie

                                    Thanks a lot petemuir for devoting so much time answering my questions. Now I understood the idea and I try to implement it in my application.

                                    Best regards,
                                    jquery