Spring mvc 如何在“中传递多个表单参数”;th:行动“;使用themleaf
我试图在Spring mvc 如何在“中传递多个表单参数”;th:行动“;使用themleaf,spring-mvc,model-view-controller,thymeleaf,Spring Mvc,Model View Controller,Thymeleaf,我试图在th:action <form class="form-inline" th:object="${search}" method="get" action="search.html" th:action="@{'/hotels/'+${search.location}+'/'+${search.adults}+'/'+${search.dateCheckOut}+'/'+${search.dateCheckIn}}" id="search-hotel-form">
th:action
<form class="form-inline" th:object="${search}" method="get" action="search.html" th:action="@{'/hotels/'+${search.location}+'/'+${search.adults}+'/'+${search.dateCheckOut}+'/'+${search.dateCheckIn}}" id="search-hotel-form">
<select class="selectpicker form-control input-lt" th:field="*{location}" id="city">
<option value="delhi">Delhi</option>
</select>
<input type='text' th:field="*{dateCheckIn}" id="datetimepicker1" />
<input type='text' th:field="*{dateCheckOut}" id="datetimepicker2" />
</form>
但得到错误是错误的
HTTP Status 500 - Request processing failed; nested exception is java.text.ParseException: Unparseable date: "null"
URL部分看起来像这样
http://localhost:8080/hotels/null/0/null/null?location=delhi&dateCheckIn=04%2F07%2F2015+09%3A00&dateCheckOut=04%2F07%2F2015+20%3A00&adults=1
您好,Sanchit,请检查您如何处理pathvariables、表单提交(以及使用的方法)和spring控制器中的@ModelAttribute,我建议您开始使用一些示例应用程序,可能是:您好,Patrick,我能够解决这个问题,基本上是路径结构的问题,调用时变为null()谢谢:-)
http://localhost:8080/hotels/null/0/null/null?location=delhi&dateCheckIn=04%2F07%2F2015+09%3A00&dateCheckOut=04%2F07%2F2015+20%3A00&adults=1