【问题标题】:fetch data from Oracle 11 DB using HQL to show it on a webpage使用 HQL 从 Oracle 11 DB 获取数据以在网页上显示
【发布时间】:2018-10-20 11:29:37
【问题描述】:

我的特定学生的所有数据都在以 StudentId 作为主键的学生表中,我可以使用 HQL 获取 StudentObject 列表中的数据(我正在尝试获取在说同一个班级)但是我应该如何在前端制作一个表格来显示所有使用 HTML 和 AngularJS 的学生的详细信息?

【问题讨论】:

    标签: java html angularjs hibernate hql


    【解决方案1】:

    假设您已经公开了将学生对象列表作为 Json 字符串返回的服务器端 API。您可以通过角度使用 $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 表格并在你的元素上使用 ng-repeat 循环遍历学生:

    <tr ng-repeat="student in studentList">
    

    在 td 中,您可以使用 {{student.Name}} 例如获取您的姓名或您想要的任何数据:

    <td>{{student.Name}}</td>
    

    希望我有帮助,祝你好运:)

    【讨论】:

      猜你喜欢
      • 2016-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-15
      • 2021-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多