2 Replies Latest reply on Aug 7, 2008 10:03 PM by Justin S.

    Retriving a resultList with jsFunction

    Justin S. Newbie

      I am trying to get the a4j:jsFunction to return the results of the getResultList() method on an EntityList. The sample code I am using is below:

      <script type="text/javascript">
      function displayResults(data){
          <a4j:jsFunction data="#{userList.resultList}" name="getResultList_JSON" oncomplete="displayResults(data)"/>
      <a href="#" onclick="getResultList_JSON()">Show User List</a>

      The problem is that this code throws a ServletException with the message Error in conversion Java Object to JavaScript. Has anyone run into this before? It seems as if something this simple should be a no brainer, but I'm obviously either missing something or have found a bug.

      BTW: I am going down this path with a4j:jsFunction because I am required to use the ExtJS framework rather than RichFaces or ICEFaces due to a customer requirement. jsFunction seems to be the easiest way to get Seam and ExtJS to talk using JSON as the medium.

      Thanks for any help you can shed on this.

      - Justin

        • 1. Re: Retriving a resultList with jsFunction
          System Administrator Expert

          1) ajax4jsf is now part of Richfaces.  not sure if you can download ajax4jsf without Richfaces...

          2) Seam remoting is another option I've used in the past and seems to work pretty reliably.

          see chapter 21 in Seam ref doc:

          Seam provides a convenient method of remotely accessing components from a web page, using AJAX
          (Asynchronous Javascript and XML). The framework for this functionality is provided with almost no up-front
          development effort - your components only require simple annotating to become accessible via AJAX.
          • 2. Re: Retriving a resultList with jsFunction
            Justin S. Newbie

            This doesn't really answer my question as to why I'm getting the error Error in conversion Java Object to JavaScript when trying to access the resultList via <a4j:jsFunction/>.

            I have done some digging since my post yesterday and in looking at the a4j toScript() method it looks like it only supports the standard Java objects (Arrays, Maps, Collections, etc...). I'm assuming that whatever Seam's getResultList() is returning it isn't in this list and so toScript() can't convert it and the exception is raised. If that is the case, then how are others exposing the internals of the Seam components via jsFunction? Or are they?

            - Justin