Я создаю страницу регистрации для веб-сайта, но когда я захожу на страницу, я получаю сообщение об ошибке: Ошибка при выполнении процессора 'org.thymeleaf.spring5.processor.SpringInputGeneralFieldTagProcessor'
Контроллер
@RequestMapping(value = { "/signup" }, method = RequestMethod.POST)
public ModelAndView createUser(@Valid AppUser appUser, BindingResult bindingResult) {
ModelAndView model = new ModelAndView();
AppUser appUserExists = appUserService.findByEmail(appUser.getEmail());
if (appUserExists != null) {
bindingResult.rejectValue("email", "error.user", "This email already exists!");
}
if (bindingResult.hasErrors()) {
model.setViewName("user/signup");
} else {
appUserService.saveUser(appUser);
model.addObject("msg", "User has been registered succesfully!");
model.addObject("appuser", new AppUser());
model.setViewName("user/login");
}
return model;
}
Форма
<form class="form-horizontal" role="form" th:action="@{/signup}" th:object="${appUser}" method="post" style="border: 1px solid #ccc">
<label for="name">First Name</label>
<input type="text" th:field="*{firstname}" class="form-control" id="firstname" placeholder="First Name" required autofocus />
<label for="name">Last Name</label>
<input type="text" th:field="*{lastname}" class="form-control" id="lastname" placeholder="Last name" required autofocus />
<label for="email"><b>Email</b></label>
<input type="email" th:field="*{email}" class="form-control" id="email" placeholder="[email protected]" required autofocus />
<label for="psw"><b>Password</b></label>
<input type="password" th:field="*{password}" class="form-control" id="password" placeholder="Password" required />
</form>
Класс пользователя приложения
@Entity
@Table(name = "user")
public class AppUser {
@Id
@Column(name = "id_user", length = 10, nullable = false, unique = true)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "firstname", length = 30, nullable = false, unique = true)
private String firstName;
@Column(name = "lastname", length = 30, nullable = false, unique = true)
private String lastName;
@Column(name = "email", length = 30, nullable = false, unique = true)
private String email;
@Column(name = "password", length = 500, nullable = false, unique = false)
private String password;
@Column(name = "active", nullable = false)
private int active;
public AppUser() {
super();
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
....
}
Из того, что я вижу, здесь нет ничего плохого, поэтому я застрял. Любые идеи?
*{...}
, предполагаетсяth:object
, поэтому это не должно быть*{appuser.firstname}
. - person iuliiamaria   schedule 11.09.2019