first of all,i am fairly new with spring mvc so ..
how springmvc find the right class to instantiate and fill its object properties when sending post-request to some controller. for example lets assume i have this class
package springmvc_test.user
public class User {
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;
}
}
and controller class as the flowing
@Controller
@RequestMapping(value = {"/user"} )
public class UserController {
private List users;
@Autowired
public UserController(List users) {
this.users = users;
}
@RequestMapping(value = "/add",method = POST)
public String addUser(User user,Model m){
users.add(user);
//do some other stuf
//.....
}
}
when i do post-request for http://localhost/myapp/user/add along with form fields that has the same names as User class properties, it works fine.
but my question is that how could springmvc find the User class and instantiated it ?although the User class is not annotated with noting at all
note: i know that spring binds the User object properties by matching their names with form fields names
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)