jsf-extensions
  1. jsf-extensions
  2. JSF_EXTENSIONS-3

Need to return JSON in reponse instead of HTML

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      3

      Description

      Instead of replacing newly rendered HTML, I need to return JSON in the response
      to update HTML elements manually. (For example, I have a table which uses a
      scroll bar. Instead of replacing the entire table, I need to append additional
      rows to the existing DOM object.) I see that the suppressXML option can be used
      with FacesEvent, allowing any language to be used; however, I still need a way
      to get a hold of the JSON data returned in the response. I also prefer that this
      implementation handle the encoded client state string.

      Would it be possible to provide a JavaScript callback function here? For
      example, if a call back function is provided, the implementation would not
      attempt to replace HTML. Instead, the callback function would be invoked with
      the data contained in the XML schema. I'm envisioning that this callback
      function may take a couple parameters to identify the ajaxZone we're working
      with and the data returned in the request. For example:

      webui.textField.validate = function(ajaxZone, data) {}

      The XML returned in the response might incude a new "data" tag as shown below.
      Although, the "markup" tag could also be reused.

      <partial-response>
      <components>
      <render id="form:table"/>
      <data><![CDATA[
      JSON string from component
      ]]></data>
      <messages>
      <message>The messages element is optional. If present,
      it is a list of FacesMessage.getSummary() output
      </message>
      </messages>
      </render>
      <!-- repeat for the appropriate number of components -->
      </components>
      <state><![CDATA[state information for this view ]]></state>
      </partial-response>

      An alternative approach may be to provide a JavaScript API, similar to how
      developers would retrieve component messages from the XML above. Perhaps we
      might consider using the Dojo event system to subscribe/publish an event,
      indicating that we have a response and data is ready to be retrieved?

      Thanks,
      Dan Labrecque

        Activity

        Hide
        Ed Burns added a comment -

        I am no longer tracking progress of these projects on java.net.

        Show
        Ed Burns added a comment - I am no longer tracking progress of these projects on java.net.

          People

          • Assignee:
            Ed Burns
            Reporter:
            danl
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: