您的位置:首页 > 编程语言 > Java开发

struts2 配置错误There is no result type defined for type 'json'

2014-03-03 10:31 676 查看
    在struts2的配置中看到 <result type="json"></result>,启动项目后,发现后台直接运行错误,

[com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]2013-05-18 10:17:59,232 [localhost-startStop-1]

[DEBUG] - The result type [org.apache.struts2.json.JSONResult] doesn't have a default param [DEFAULT_PARAM] defined!

[com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]java.lang.NoSuchFieldException: DEFAULT_PARAM

at java.lang.Class.getField(Class.java:1539)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:569)

at...

     和There is no result type defined for type 'json' ,将struts2-json-plugin-*.jar的版本号又2.1.8升级成2.1.16就ok拉!

<package name="/"
extends="json-default">  
    <action name="aname" class="relationAction" method="getTeamByCounty">  
        <result name=“list” 
type="json" />  
    </action> 

    注意:上面的这个extends ,默认的是继承struts-default,所以这里也需要修改,需要继承json-default。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  struts2 json param_defalut