1 Reply Latest reply on Mar 7, 2007 4:03 AM by pmuir

    SeamSelectItemsNewDesign Problem with converting

      hi petemuir,
      i found your project "SeamSelectItemsNewDesign", i tryed to use it, download selectitems-1.1.1beta4.

      than i put selectitems.jar and selectitems-ui.jar into my WEB-INF/lib.

      then i tryed to fill application combo with application name
      Application class is simple database entity bean has properties applicId,name,code,description

      then i wrote entity query into my componets.xml file

      <framework:entity-query name="applications" ejbql="select a from Application a" />
      

      and then i wrote simple converter class
      @Name("exampleBean")
      public class ExampleBean extends SelectItemsConverter {
      
       @Override
       protected String convertToString(FacesContext facesContext, UIComponent uIComponent, Object object) throws ConverterException {
       return ":::";
       }
      
       @Override
       protected Object convertToObject(FacesContext facesContext, UIComponent uIComponent, String string) throws ConverterException {
       return new Application();
       }
      }
      


      and in the end into my facelet i wrote this :

      <h:selectOneMenu styleClass="font_style" value="#{application.name}" converter="#{exampleBean}">
       <si:selectItems value="#{applications.resultList}" var="application" label="#{application.name}" />
       </h:selectOneMenu>
       <h:messages style="color: red" for="application"/>
      


      i found discussion about this problem
      http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4001066#4001066

      you said :

      The first issue I suspect is a class loading problem - you probably have multiple (stale) copies of the selectitems.jar floating around.

      i'm sure that i had only one selectitems.jar and selectitems-ui.jar into my ear file
      which contains war file, such contains this files into web-inf/lib folder

      i also read this and done everything
      http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamEntityConverter

      but i got an error again and again :(
      javax.faces.FacesException: Converter must implement SelectItemsConverter: com.magticom.billing.businesslayer.sessionbeans.ccare.ExampleBean@1c2832e
       at org.jboss.seam.selectitems.ui.UISeamSelectItems.addConverters(UISeamSelectItems.java:364)
       at org.jboss.seam.selectitems.ui.UISeamSelectItems.getValue(UISeamSelectItems.java:246)
       at org.apache.myfaces.shared_impl.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:102)
       at org.apache.myfaces.shared_impl.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:477)
      



      what did i wrong ? i did not changed entitymanager and i think i must not add any config into my components.xml

      Regards,
      Paata.


        • 1. Re: SeamSelectItemsNewDesign Problem with converting
          pmuir

          SeamSelectItems is deprecated in favour of s:selectItems and ec:entityConverter (soon to be s:entityConverter).

          As I've said before you aren't using these controls right. Get this working on a standard setup (association between entities) by following the examples THEN apply it to your own situation.


          Oh, and that converter you show below will never work.