Java, Struts 1.2, Json Angular JS - 我怎样才能得到 json 动作 class 对我的 Angular JS 的响应页?

Java, Struts 1.2, Json Angular JS - How can I get json response from action class to my Angular JS page?

我需要澄清以下技术

当前技术: Struts 1.2 Jsp Java AngularJS

目前我正在尝试将我的 jsp 页面之一迁移到客户要求的 AngularJS 页面。

我正在尝试使用下面的代码来获取 json 响应,但我无法在我的 jsp 页面中获取 json 数据。

问题: 1) 如何从 struts 中的动作 class 的响应中获取 json 对象?

2) 目前: 注意:我能够使用 session.setAttribute() 和 getAttribute 在 jsp 中获取 json 对象的一种临时方法。但它不是礼节性的方法,因为我只是得到我所有的 table 数据并放入会话中。除此之外,请帮忙..

代码: 在 jsp:

$scope.getDataFromServer = function() {

            $http({
                method : 'GET',
                url : '/com/test/Browse.do'
            }).then (function successCallback(response) {
            var itemsDetails = JSON.parse(response);

                $scope.person = response;
            }).error(function(data, status, headers, config) {

            });

        };
**//The above response getting as object unable to get json object.**

In action class:
public void doExecute(ActionContext ctx) throws IOException,
            ServletException {
                PersonData personData = new PersonData();//[PersonData class available]
        personData.setFirstName("Mohaideen");
        personData.setLastName("Jamil");

        String json = new Gson().toJson(personData);

                ctx.forwardToInput();
}

我可以像下面这样使用会话属性获取数据,但这不是让我避免 struts 操作以及将整个 table 数据放入会话中的常规方法我不确定是否它将以仪式方式或安全方式进行。 var data1 = '<%=session.getAttribute("jsonobjtest")%>';

能否帮我找到使用 struts 1.2 和 angularjs 的常规方法?如果我们做不到,请帮助我指导解决方法 angularjs?

根据我的理解,你想从 Java 后端获取一个 json 对象 这是我如何在 AngularJs 1.5.11

中执行 http 请求

(function () {
 'use strict';

 angular.module("myapp")

.controller("HelloController", function($scope,$http){
        $scope.getDataFromServer = function() {
            $http.get("/com/test/Browse.do").success(function(response,status){
                 //console.log(response,status); check your data 
                 $scope.person = JSON.parse(response);
            });
          }

});