javascript 如何将数据带入一行

li9yvcax  于 2023-05-21  发布在  Java
关注(0)|答案(1)|浏览(127)

我有一个表,显示课程的详细信息与Thymeleaf调用数据,我有“应用”按钮来应用课程。我想在单击“Apply”按钮时将course.html中的值带到applycourse.html中。
course.html

<table id="coursetable" class="coursetable">
    <thead>
        <tr>
            
            <th>Status</th>
            <th>Course Code</th>
            <th>Course No</th>
            <th>Course Name</th>
            <th>Course Date (Time)</th>
            <th>Apply</th>
            
        </tr>
    </thead>
    <tbody>
        <tr  th:each="class : ${inclass}" th:data-row="${class}">
            
            <td th:text="${class.classStatus}"></td>
            <td th:text="${class.courseId.courseCode}" 
            th:style="${class.courseId.courseCode}"></td>
            <td th:text="${class.classNo}"></td>
            <td th:text="${class.courseId.courseTitleEng}"></td>
            <td th:text="${class.classDate}"></td>
            <td><a  href="../CourseRegistration-NotesForOnlineApplication/individual/individualapplication" class="spinner-trigger-button">Apply</a></td>
        </tr>

    </tbody>
</table>
b1uwtaje

b1uwtaje1#

使用Thymeleaf的Standard URL Syntax将变量放入URL中。例如:

<td>
    <a th:href="@{../CourseRegistration-NotesForOnlineApplication/individual/individualapplication(classNo=${class.classNo})}" class="spinner-trigger-button">Apply</a>
</td>

会生成一个类似于以下内容的URL:

<a th:href="../CourseRegistration-NotesForOnlineApplication/individual/individualapplication?classNo=500" class="spinner-trigger-button">Apply</a>

相关问题