首页 > 解决方案 > 我正在尝试将显示表从一个 HTML 页面移动到另一个页面,但新页面无法识别旧页面所做的某些元素

问题描述

所以我想做的是这个;

我之前有一个名为“我的个人资料”的页面,用户可以选择搜索他们的约会,并且必须输入他们的用户名才能这样做,然后将他们重定向到他们的约会页面,或查看他们的详细信息,这是在一样的方法。我想做的是消除对“我的详细信息”和“我的约会”页面的需要,而是默认显示个人资料页面,使用他们当前登录的用户名作为显示参数;

我试图将表格直接从我的约会复制到个人资料页面,但有些元素无法识别,我不确定为什么;

<h2>Your appointment(s) <a th:href="@{/profile}" type="submit"
                               class="text-uppercase btn btn-primary shadowed w-50">Back</a> </h2>
    <table class="table table-striped">
      <tr>
        <th>Id</th>
        <th>Test Center</th>
        <th>CPR</th>
        <th>TIME</th>
        <th>DATE</th>
        <th colspan = "2">Actions</th>

      </tr>
      <tr th:each="appointment: ${userCpr}">
        <td th:text="${appointment.getApptId()}"></td>
        <!-- <td th:text="${appointment.getTestCenterId()}"></td>-->
        <td th:text="${iTestCenterService.findTestCenterById(appointment.getTestCenterId()).getName()}"></td>
        <td th:text="${appointment.getCprOfUser()}"></td>
        <td th:text="${appointment.getTime()}"></td>
        <td th:text="${appointment.getDate()}"></td>

        <td><a class="btn btn-primary"
               th:href="@{/updateAppointment/{apptID}(apptID=${appointment.getApptId()})}">Update</a> </td>

        <td><a class="btn btn-warning"
               th:href="@{/deleteMyAppointment/{apptID}(apptID=${appointment.getApptId()})}">Cancel</a></td>

      </tr>
    </table> 

这是“我的约会”页面中显示的整个表格

    <h2>Your appointment(s)</h2>

    <table class="table table-striped">
      <tr>
        <th>Id</th>
        <th>Test Center</th>
        <th>CPR</th>
        <th>TIME</th>
        <th>DATE</th>
        <th colspan = "2">Actions</th>

      </tr>
      <tr th:each="appointment: ${userCpr}">
        <td th:text="${appointment.getApptId()}"></td>
        <!-- <td th:text="${appointment.getTestCenterId()}"></td>-->
        <td th:text="${iTestCenterService.findTestCenterById(appointment.getTestCenterId()).getName()}"></td>
        <td th:text="${appointment.getCprOfUser()}"></td>
        <td th:text="${appointment.getTime()}"></td>
        <td th:text="${appointment.getDate()}"></td>

        <td><a class="btn btn-primary"
               th:href="@{/updateAppointment/{apptID}(apptID=${appointment.getApptId()})}">Update</a> </td>

        <td><a class="btn btn-warning"
               th:href="@{/deleteMyAppointment/{apptID}(apptID=${appointment.getApptId()})}">Cancel</a></td>

      </tr>
    </table> 

这是在“我的个人资料”页面中显示的

出于某种原因,“我的个人资料”页面中的所有约会元素都没有被识别,它们在我的约会页面中。

任何尝试解决此问题的帮助将不胜感激。我也很感谢尽可能外行的帮助 - 我不是最擅长的。

标签: javahtmlcssspring-boot

解决方案


推荐阅读