【发布时间】:2018-10-02 22:38:40
【问题描述】:
我在一个项目中使用 spring boot 和 thymeleaf,我在 URL 中发送一些参数,例如“Historique/stock?devise=EUR”
我想知道是否有一个全局配置来编码 url 和我的控制器中的参数来解码它
谢谢你:)
更新:
<tbody>
<tr th:each="agence : ${listeAgences}">
<td><input th:type="checkbox" th:name="selected"
th:value="${agence?.id}" /></td>
<td><a class="btn-outline-primary"
th:href="@{'/admin/Agence/visualisationAgence?id='+${agence.id}}"><th:block
th:text="${agence?.nom}" /></a></td>
</tr>
</tbody>
这是我的控制器
@RequestMapping(value = "/visualisationAgence", method = RequestMethod.GET)
public ModelAndView visualisationAgence(ModelAndView modelAndView, String id) {
AgenceDTO agence = agenceService.findAgenceById(Integer.parseInt(id));
如您所见,我正在传递未编码的 id,我不知道是否有一个全局方法如何对其进行编码然后读取它,因此用户无法在 url 中看到 id
【问题讨论】:
标签: spring spring-boot spring-security thymeleaf