Warning |
---|
This page is DEPRECATED, please refer to the new source http://struts.apache.org/plugins/json/ |
Table of Contents |
---|
The JSON plugin
Excerpt |
---|
provides a "json" result type that serializes actions into JSON |
...
Code Block |
---|
@InterceptorRef(value="json") |
By default Content-Type
of value application/json
is recognised to be used for de-serialisation and application/json-rpc
to execute SMD processing. You can override those settings be defining jsonContentType
and jsonRpcContentType
params, see example:
Code Block | ||||
---|---|---|---|---|
| ||||
<interceptor-ref name="json">
<param name="jsonContentType">text/json</param>
<param name="jsonRpcContentType">text/json-rpc</param>
</interceptor-ref> |
Please be aware that those are scoped params per stack, which means, once set it will be used by actions in scope of this stack.
JSON RPC
The json plugin can be used to execute action methods from javascript and return the output. This feature was developed with Dojo in mind, so it uses Simple Method Definition to advertise the remote service. Let's work it out with an example(useless as most examples).
...