首页>代码>Spring MVC用户注册配置入门教程及其代码实例demo下载>/RegUser/src/main/java/com/zuidaima/user/controllers/UserManagerController.java
package com.zuidaima.user.controllers; import java.util.Map; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.zuidaima.user.model.User; @Controller public class UserManagerController { @Autowired private UserValidation userValidation; /** * 响应注册页面请求 * @param model * @return */ @RequestMapping(value="/toAddUserPage") public String toAddUserPage(Map<String, User> model) { User user = new User(); model.put("user", user); return "user/add"; } /** * 处理注册请求 * @param user * @param result * @return */ @RequestMapping(value="/adduser", method = RequestMethod.POST) public String processRegistration(@Valid User user,BindingResult result) { userValidation.validate(user, result); if (result.hasErrors()) { return "user/add"; } return "user/addSuccess"; } }

李亮 LV19
2023年3月7日
a1677596408 LV23
2022年7月1日
543666826 LV34
2021年11月28日
15827485252 LV19
2021年8月4日
Sunny_yan LV9
2021年4月1日
0011100 LV12
2020年6月10日
f123654789 LV17
2019年9月19日
yangdong LV13
2019年8月7日
半夜起来删代码 LV2
2019年6月20日
hxxxxxx LV1
2019年5月23日

ma406805131 LV19
2024年12月4日
dapeng0011 LV15
2024年7月16日
renxi222
2024年2月29日
暂无贡献等级
你爹正在加载中 LV4
2023年8月3日
小妹妹 LV7
2023年5月22日
win1991 LV6
2023年5月14日
李亮 LV19
2023年3月7日
a1677596408 LV23
2022年7月1日
兰文斌 LV6
2022年5月4日
HCY666 LV2
2021年12月21日