I'm having a problem signing in to.
I have a simple page:
Ijustneedtoquerythedatabaseifthevalueenteredbytheuseristhesame.
Thisonehere:
Model:
@EntitypublicclassUser{@Id@GeneratedValue(strategy=GenerationType.IDENTITY)privateIntegerid;@ColumnprivateStringlogin;@ColumnprivateStringpassword;@ColumnprivateStringbirdayDate;@ColumnprivateStringmail;@OneToOne(mappedBy="user")
private Company company;
public User() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getBirdayDate() {
return birdayDate;
}
public void setBirdayDate(String birdayDate) {
this.birdayDate = birdayDate;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
}
View:
<!-- BEGIN LOGIN FORM -->
<form id="form-login" method="POST" class="p-t-15" role="form"
action="login">
<!-- BEGIN USERID -->
<div class="form-group form-group-default">
<label>Usuário</label>
<div class="controls">
<input type="text" name="userId" id="userId"
placeholder="Usuário" class="form-control" required>
</div>
</div>
<!-- END USERID -->
<!-- BEGIN PASSWORD -->
<div class="form-group form-group-default">
<label>Senha</label>
<div class="controls">
<input type="password" class="form-control" name="password"
placeholder="Senha" required>
</div>
</div>
<!-- END PASSWORD -->
<!-- BEGIN SUBMIT BUTTON -->
<button class="btn btn-primary btn-cons m-t-10" id="loginButton"
type="submit">Entrar</button>
<!-- END SUBMIT BUTTON -->
</form>
<!-- END LOGIN FORM -->
Controller:
@RequestMapping(value = "/public/login", method = RequestMethod.GET)
public ModelAndView loginPage() {
return new ModelAndView("login");
}
@RequestMapping(value = "/public/login", method = RequestMethod.POST)
public ModelAndView verifyLogin(@RequestParam String userId, @RequestParam String password) {
User user = new User();
return new ModelAndView("home");
}