java 用户名不为空

编程入门 行业动态 更新时间:2024-10-14 18:21:17

java 用户名不<a href=https://www.elefans.com/category/jswz/34/1771092.html style=为空"/>

java 用户名不为空

今天主要实现了用validation实现登陆页面,注册页面,修改信息页面用户名,ID,密码不能为空的操作

一 登陆页面的信息不能为空的实现,主要代码:首先进行包的导入

helloWorld.html中

th:errors="${userBean.*}">

HelloWorldCotrolller.java中

// 登陆(将查询的结果返回给result)

@RequestMapping(value = "/init", method = RequestMethod.POST, params = "a")

public String initUpdate(Model model, HttpSession session,

@Valid @ModelAttribute("userBean") UserBean userBean,

BindingResult results) throws SQLException {

int init = helloWorldService.update(userBean);

if (results.hasErrors()) {

log.info("用户名或密码不能为空");

return "helloWorld";

}//主要实现用户名密码不能为空

UserBean result = helloWorldService.searchUser(userBean);

model.addAttribute("userBean", result);//存userBean的值

更多推荐

java 用户名不为空

本文发布于:2024-03-09 21:29:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1726149.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:为空   用户名   java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!