I want to take the data from an input form(log in data->password+username) and save it into a bean. Then, i want to take this bean and the data inside and make a get reuest.
I declare a class:
public class Login {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
The getrequest is the following:
@RequestMapping(value = "/log",method = RequestMethod.GET)
public String addPersonLogin( Model model,HttpServletRequest request) {
//take the bean here
}
Can anyone tells me how can i create the jsp and how can i treat the bean into the addPersonLogin?
You can do it that way (using @ModelAttribute):