parameters - Thymeleaf 请求参数
问题描述
我正在使用 thymeleaf 和 spring boot,我想将请求参数发送到控制器方法,但 thymeleaf 也在发送空值,我怎样才能只发送实际具有值的参数。
<form class="col s12" th:action="@{/browse}" method="get">
<input id="newStatusName" th:name="status">
<input id="driverName" th:name="driver">
<input id="vehicleName" th:name="vehicle">
<button> Search </button>
</form>
问题是当我提交表单而没有在输入中写入任何内容时,我得到了 url:
http://localhost:8090/browse&status=&driver=&vehicle=
如果没有值,我想要正常的 url:
http://localhost:8090/browse
解决方案
推荐阅读
- websocket - 通过 webscoket 连接 ESP8266 客户端(无库,只有 AT 命令)
- scala - Scala 是否支持 OR 组合?
- c# - DeleteAsync 方法在 Azure 人脸识别服务中不起作用
- python - 在 Keras 中设计自定义损失函数时使用第三个变量列表
- selenium - 下面的 HTML 标记的 xpath/Css 选择器可能是什么,如何使用 Selenium xpath 选择特定的单选按钮
- xml - 处理 ebXML - InputStream 不代表有效的 SOAP 1.1 消息
- mongodb - 识别mongodb的进程类型
- c - LCD 4 位与 PIC16 通信
- oracle - PL/Sql 查询存储变量数组
- javascript - 我有一个数字输入,我想转换成十进制反应 js