spring mvc - How to pass multiple form parameter in "th:action" using themleaf -
i trying pass parameter in 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>
then spring mvc contoller part
@requestmapping(value = "/hotelsparam/{datecheckin}/{datecheckout}/{location}", method = requestmethod.post) public modelandview searchhotel(@pathvariable("datecheckout") date datecheckout, @pathvariable("datecheckin") date datecheckin,@pathvariable("location") string location, bindingresult bindingresult) throws parseexception {.... //remove implemntation make precise }
but getting error
http status 500 - request processing failed; nested exception java.text.parseexception: unparseable date: "null"
url part seem
http://localhost:8080/hotels/null/0/null/null?location=delhi&datecheckin=04%2f07%2f2015+09%3a00&datecheckout=04%2f07%2f2015+20%3a00&adults=1
Comments
Post a Comment