can't set Struts2 result type to json

You don't have the JSON result defined in your struts.xml package. If you only need default things then you can just extend json-default instead of struts-default. If you need to customise the package then include the following and that should do the trick:

    <result-types>
        <result-type name="json" class="com.googlecode.jsonplugin.JSONResult"/>
    </result-types>

you package should extends json-default

<package name="json-default" extends="struts-default">
    <result-types>
        <result-type name="json" class="org.apache.struts2.json.JSONResult"/>
    </result-types>
    <interceptors>
        <interceptor name="json" class="org.apache.struts2.json.JSONInterceptor"/>
    </interceptors>
</package>

Tags:

Json

Struts2