【发布时间】:2015-09-16 19:06:21
【问题描述】:
我正在使用 angularjs 开发一个 spring restful 应用程序。在 Spring 中,我使用 maven 和 Hibernate。
我已经使用 spring rest 返回了 json 对象,但我不知道如何使用 $resource 在我的角度控制器中使用这个对象
这是我的弹簧休息控制器
@RequestMapping(value = "/list", method = RequestMethod.GET)
public @ResponseBody
List<Employee> getEmployee() {
List<Employee> employeeList = null;
try {
employeeList = dataServices.getEntityList();
} catch (Exception e) {
e.printStackTrace();
}
return employeeList;
}
这是我的jsp
<body>
<h3>FirstName:</h3>
<!-- First name from json object -->
<p></p>
<h3>LastName:</h3>
<!-- Last name from json object -->
<p></p>
</body>
所以请帮我处理 angularjs 控制器代码
我的应用名称是:SpringRestCrud1
我用来返回 json 对象的路径是:http://localhost:8080/SpringRestCrud1/employee/list
我的结果是:[{"id":3,"firstName":"Hoston","lastName":"lindey","email":"hl@gmail.com","phone":"90908989899 "}]
【问题讨论】:
标签: java angularjs spring hibernate rest