This article mainly introduces you to the relevant information about passing object parameters in spring MVC. The article introduces it in detail through sample code, which has certain reference and learning value for everyone. Friends who need it Let’s take a look below.
Preface
<a href="http://www.php.cn/java/java-ActiveRecord-Model.html" target="_blank"></a>
@RequestMapping("hello") public String Hello(@ModelAttribute("user") User user) { System.out.println(user.getUserName()); return "hello"; }
public class User { private int userID; private String userName; public int getUserID() { return userID; } public void setUserID(int userID) { this.userID = userID; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } }
The above is the detailed content of Detailed explanation of object parameter passing examples in spring MVC in JAVA. For more information, please follow other related articles on the PHP Chinese website!