如何将在 get 请求中检索到的对象发送到 post requet |Spring Boot Thymeleaf [英] How to send object that is retrived in a get request to a post requet | Spring Boot Thymeleaf
本文介绍了如何将在 get 请求中检索到的对象发送到 post requet |Spring Boot Thymeleaf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我已经在 html 模板上呈现了 get 请求的输出,现在我需要使用相同的数据通过同一页面上的按钮传递给发布请求.我该怎么做?
我正在尝试做这样的事情:
<html xmlns="http://www.w3.org/1999/xhtml"xmlns:th="http://www.thymeleaf.org"><头><title>客户主页</title><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>头部><身体><div th:replace="fragments/header::header">
<div class="容器"><p>感谢您通过 Gamma Airlines 预订,以下是您的预订摘要:</p><table th:object="${booking} class="table table-bordered table-striped">
<tr><td>来源</td><td th:text="${routeStart}"></td></tr><tr><td>目的地</td><td th:text="${routeDestination}"></td></tr><tr><td>预订费用</td><td th:text="${bookingCharges}"></td></tr><tr><td>预订费用货币</td><td th:text="${chargesCurrency}"></td></tr><tr><td>预订日期</td><td th:text="${#calendars.format(bookingDate)}">2012 年 7 月 11 日下午 2:17:16 CDT</td><tr><td><div class="col-sm-9"><form action="#" th:action="@{/email}"th:object="${booking}" method="post"角色=形式"><button type="submit" class="btn btn-primary btn-block">电子邮件</button></表单></td><td><div class="col-sm-9"><form action="#" th:action="@{/genpdf}"th:object="${booking}" method="post"角色=形式"><button type="submit" class="btn btn-primary btn-block">生成PDF</button></表单>
</td></tr></tbody>