使用 HQL 从 Oracle 11 DB 获取数据以在网页上显示
fetch data from Oracle 11 DB using HQL to show it on a webpage
我的特定学生的所有数据都在一个 Student Table 中,它以 StudentId 作为主键,我可以使用 HQL 获取 StudentObject 列表中的数据(我正在尝试获取相同的学生名单 class) 但我应该如何在前端制作 Table 以显示所有使用 HTML 和 [=13= 的学生的详细信息]?
假设您在服务器端 API 公开了 returns 学生对象列表作为 Json 字符串。您可以通过 angular 使用 $http 服务:
如此处所述:https://docs.angularjs.org/api/ng/service/$http
$http({
method: 'GET',
url: '/someUrl'
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
收到回复时创建一个简单的 html table 并在您的元素上使用 ng-repeat 循环遍历学生:
<tr ng-repeat="student in studentList">
并且在 td 中,您可以使用 {{student.Name}} 来获取他们的姓名或您想要的任何数据:
<td>{{student.Name}}</td>
希望我帮到你了,祝你好运:)
我的特定学生的所有数据都在一个 Student Table 中,它以 StudentId 作为主键,我可以使用 HQL 获取 StudentObject 列表中的数据(我正在尝试获取相同的学生名单 class) 但我应该如何在前端制作 Table 以显示所有使用 HTML 和 [=13= 的学生的详细信息]?
假设您在服务器端 API 公开了 returns 学生对象列表作为 Json 字符串。您可以通过 angular 使用 $http 服务: 如此处所述:https://docs.angularjs.org/api/ng/service/$http
$http({
method: 'GET',
url: '/someUrl'
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
收到回复时创建一个简单的 html table 并在您的元素上使用 ng-repeat 循环遍历学生:
<tr ng-repeat="student in studentList">
并且在 td 中,您可以使用 {{student.Name}} 来获取他们的姓名或您想要的任何数据:
<td>{{student.Name}}</td>
希望我帮到你了,祝你好运:)