1 Reply Latest reply on Jul 18, 2008 3:05 PM by jstockton

    Seam and JSON

    froden

      Hello,

      I'm creating a web application with Seam that, in addition to serving web pages, will also provide JSON objects for some Ajax calls.

      My first thought was to simply let an xhtml page return JSON, as follows:

      <html ...><head></head><body>
      
      <ui:composition>
      { "someKey": "someValue",
       "someOtherKey": "#{someBean.someValue}" }
      </ui:composition>
      
      </body></html>
      


      This became cumbersome for a number of reasons, and I pressume this is not the most elegant way to do it.

      My second thought was to create an old fashioned servlet to return the JSON data. I am, however, having some problems accessing Seam features, EntityManager etc in the servlet.

      So, I am wondering, what is the best practice for doing this in a Seam web application? All suggestions are welcome.

      ~Frode

        • 1. Re: Seam and JSON
          jstockton

          I've been having the exact same thoughts with regards to Seam and JSON. Did you ever solve this problem?

          In particular I've been wondering if there is a general preference given to one of the many JSON libraries out there and if so why?