Class JsonResult

  • All Implemented Interfaces:
    com.opensymphony.xwork2.Result, Serializable, org.apache.struts2.StrutsStatics

    public class JsonResult
    extends org.apache.struts2.result.StrutsResultSupport
    This result will format the the a result of the action using JSON. This result will look at the JSONString property of the action and will send it to the client.

    This result will set the content type to 'application/javascript'.

    More recent webwork libraries contain a slightly different implementation a JSON Result. This result was based on that implementation to (hopefully) allow for a clean upgrade path when the time comes to update webwork.

    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.apache.struts2.result.StrutsResultSupport

        DEFAULT_PARAM, DEFAULT_URL_ENCODING, parseLocation
      • Fields inherited from interface org.apache.struts2.StrutsStatics

        ACTION_MAPPING, HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonResult()  
    • Constructor Detail

      • JsonResult

        public JsonResult()
    • Method Detail

      • doExecute

        protected void doExecute​(String finalDestination,
                                 com.opensymphony.xwork2.ActionInvocation actionInvocation)
                          throws Exception
        Specified by:
        doExecute in class org.apache.struts2.result.StrutsResultSupport
        Throws:
        Exception
      • setJsonator

        public void setJsonator​(Jsonator<Object> jsonator)
      • getJsonString

        public String getJsonString​(com.opensymphony.xwork2.ActionInvocation actionInvocation)