Dashboard > WebWork > ... > Result Types > JSON Result
  WebWork Log In View a printable version of the current page.  
  JSON Result
Added by tm_jee, last edited by tm_jee on Dec 02, 2007
Labels: 
(None)

Attempt to retrieve an instance of JSONObject from WebWork's ValueStack through property returned from #getJSONObjectProperty() and write the String representation of the retrived JSONObject to HttpServletResponse's outputstream. Normally having accessor methods for the property in WebWork's action would do the trick.

Parameters

  • contentType - Defines the content-type header to be used. Default to 'application/json'
  • jsonObjectProperty - Defines the property used to look up WebWork's ValueStack to find an instance of JSONObject. Default to 'jsonObject'.

Examples

<action name="getActiveCustomers" class="...">
     <result name="success" type="json">
         <param name="jsonObjectProperty">activeCustomer</param>
         <param name="contentType">application/json</param>
     </result>
     ...
 </action>>

 Or just

 <action name="getActiveCustomers" class="...">
     <result name="success" type="json" />
     ...
 </action>

 if we used the default property ('jsonObject') and default content-type ('application/json')

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators