<form action="#" th:action="@{/signinValidation}" th:object="${AdminSignin}" method="post">
<div class="form-group mb10">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" class="form-control" placeholder="Enter Username" name="adminName" th:field="*{adminName}" />
</div>
</div>
<div class="form-group nomargin">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input type="password" class="form-control" placeholder="Enter Password" name="adminPass" th:field="*{adminPass}" />
</div>
package com.jxanyway.cpm.entity;
public class AdminSignin {
private String adminName;
private String adminPass;
.....get ,set
@RequestMapping(value="/signinValidation", method=RequestMethod.POST)
public String signigValidation(AdminSignin adminSignin) {
System.out.println(adminSignin.toString());
return "index";
}
------解决思路----------------------
AdminSignin不是HttpRequest的子类,编译器不会自动将数据转换成AdminSignin类型的。做法:public class AdminSignin extends StringAndEqualsObject 或者 public class AdminSignin implements Model