升级到struts2.5.8后,JSON响应不起作用

升级到struts2.5.8后,JSON响应不起作用,json,ajax,struts2,Json,Ajax,Struts2,在我将struts从2.3.x升级到2.5.8之前,JSON可以向我返回数据,但是现在返回的JSON值在struts2.5.8中是空的,不管我输入了什么类型。这是我的密码: TestController.java public class TestingController implements ModelDriven<Object> { private ArrayList<Test> testList = null; public ArrayList<Te

在我将struts从2.3.x升级到2.5.8之前,JSON可以向我返回数据,但是现在返回的JSON值在struts2.5.8中是空的,不管我输入了什么类型。这是我的密码:

TestController.java

public class TestingController implements ModelDriven<Object> {
  private ArrayList<Test> testList = null;
  public ArrayList<Test> getTestList() { return testList;}

  public String tableData() {
    jsonMap = new HashMap<String, Object>();
    testList = getTestListBySomething();
    if(testList!=null && testList.size()>0){
      jsonMap.put("test", testList);
    }

  }
我的编码有什么问题?

在strust xml中添加以下参数。
In your strust xml add below parameter.    


    <param name="root">#action</param>

EX :

<result-types>
   <result-type name="json" class="org.apache.struts2.json.JSONResult">
            <param name="noCache">true</param>
            <param name="excludeNullProperties">true</param>
            <param name="root">#action</param>
            <param name="ignoreHierarchy">false</param>
            <param name="excludeProperties">errors</param>
   </result-type>
 </result-types>
#行动 前任: 真的 真的 #行动 假的 错误
我不知道struts2 rest插件是如何工作的,但是
org.apache.struts2.json.JSONResult
来自struts2 json插件。它还在你的项目中吗?它有正确的版本吗?嗨,Andrea,它仍在项目中,并且都升级到2.5.8。请显示操作配置。还请记住,最好使用接口(列表)而不是实现(ArrayList)定义变量这里是操作配置:@Namespace(“/test”)@Results({@Result(name=“json”,type=“json”,params={“root”,“jsonMap”})当从2.3迁移到2.5时,您在库版本中做了哪些更改?
{"test":""}
In your strust xml add below parameter.    


    <param name="root">#action</param>

EX :

<result-types>
   <result-type name="json" class="org.apache.struts2.json.JSONResult">
            <param name="noCache">true</param>
            <param name="excludeNullProperties">true</param>
            <param name="root">#action</param>
            <param name="ignoreHierarchy">false</param>
            <param name="excludeProperties">errors</param>
   </result-type>
 </result-types>