如何在ajax中显示String数组

时间:2013-09-25 12:34:09

标签: java spring

我有一个String数组响应,我需要在Ajax调用中传递;任何人都可以帮忙吗? 我的控制器是:

@RequestMapping(value = "/getBuildrpms", method = RequestMethod.GET)
public @ResponseBody String[] getBuildrpms(
             @RequestParam("buildid") String buildid,
             ModelMap model,
             HttpServletRequest request) {
  Authentication auth = SecurityContextHolder.getContext().getAuthentication();
  String response = Util.executeCommand(Constants.HOST_NAME_FUSION,
             auth.getName(), auth.getCredentials() + "",
             Constants. SCRIPT_LIST_RPMS + buildid);
  String animals = response;
  String[] animalsArray = animals.split(",");
  return animalsArray;
}

我的Ajax电话:

function pushtotr() {
  jq(function () {
    jq("#pushtotr").html('<p><img src="../../images/load.gif"/></p>');
    jq.get("getBuildrpms", {
        buildid: jq("#buildid").val()
      },
      function (data) {
        //How can I retrive the array value here.
        jq("#pushtotr").html(data);
      });
  });
}

我想在JSP页面中显示。

0 个答案:

没有答案