12 Replies Latest reply on Oct 17, 2007 11:45 AM by elikyip

    seam converter

    armita

      I am trying to use Converter annotation without success. My class looks like

      @Converter(id = "locationConveter")
      @Name("locationConverter")
      public class LocationConverter implements javax.faces.convert.Converter {
      

      but my page could not find
      <f:converter converterId="locationConverter" />
      

      I also tried it without the @Name annotation
      The error message is:
      SEVERE: Error Rendering View[/QuotesEdit.xhtml]
      javax.faces.FacesException: Could not instantiate converter: null
      
      


        • 1. Re: seam converter
          m.shinde

          Try to define converter into the Faces-Config.xml.

          <converter>
           <converter-id>locationConverter</converter-id>
           <converter-class>LocationConverter</converter-class>
          </converter>
          


          And access it by using defined id in JSF page.

          Hope it will work.

          • 2. Re: seam converter

            ... or use an EL expression to access the converter.

            Regards

            Felix

            • 3. Re: seam converter
              armita

              Thank you guys! I hoped that the annotation will eliminate need for adding the converter to the faces-config.xml file (And if not, what is the point of "id" in converter annotation?)
              Though I could not understand how can I use EL to mention the converter.

              • 4. Re: seam converter
                armita

                I registered in the faces-config.xml file! Now the jsf could get a hold of it, but none of the seam injections seems to work. My class looks like:

                @Converter(id = "locationConveter")
                @Name("locationConverter")
                @Interceptors(SeamInterceptor.class)
                public class LocationConverter implements javax.faces.convert.Converter {
                

                I am not sure how it is supposed to work.

                • 5. Re: seam converter
                  m.shinde

                  Which seam version u r using. Try seam 1.2.1 GA

                  • 6. Re: seam converter

                    If you use injection you have to access the converter via an el expression, like #{locationConverter}.

                    Regards

                    Felix

                    • 7. Re: seam converter
                      armita

                      It is not working. I even tried the UI example of seam which uses a converter and put some logs inside the methods, but it seems that converters is not functional in Seam! Or maybe I am missing something?

                      • 8. Re: seam converter
                        elikyip

                        Wondering if you ever figured out the problem. I'm trying to use the converter too.

                        • 9. Re: seam converter
                          armita

                          Yes, actually I managed to use them. Doesn't this thread helped you to solve the problem?

                          • 10. Re: seam converter
                            elikyip

                            Actually, my problem was due to the fact that my converter was not being scanned by seam. Once I got that going everything works as expected...It almost seems like you had similar problem from your earlier posts.

                            Also, you don't have to register the converter in the faces config as suggested in earlier post (that's the whole point of using the Converter annotation).

                            And I'm using seam 1.2.1.GA.

                            • 11. Re: seam converter
                              elikyip

                              converter was not being scanned by seam. Once I got that going everything works as expected...It almost seems like you had similar problem from your earlier posts.

                              Also, you don't have to register the converter in the faces config as suggested in earlier post (that's the whole point of using the Converter annotation).

                              And I'm using seam 1.2.1.GA.

                              • 12. Re: seam converter
                                elikyip

                                Actually, my problem was due to the fact that my converter was not being scanned by seam. Once I got that going everything works as expected...It almost seems like you had similar problem from your earlier posts.

                                Also, you don't have to register the converter in the faces config as suggested in earlier post (that's the whole point of using the Converter annotation).

                                And I'm using seam 1.2.1.GA.