首页>代码>springboot+jsp+bootstrap3+接口编程开发网站demo实例>/fmoney/fmoney-html/src/main/java/com/sxy/controller/UserController.java
package com.sxy.controller; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.sxy.service.BlockService; import com.sxy.service.UserVice; import com.sxy.vo.Block; @Controller public class UserController { @Autowired private UserVice us; @Autowired private BlockService bs; @RequestMapping("/login.htm") public String Login(String name,String password,HttpServletRequest req){ Object o =us.Login(name, password); List<Block> list =bs.getBlocks(); if(o.toString().equals("该用户不存在请先注册!")||o.toString().equals("密码错误!")){ req.setAttribute("obj", o); return "index"; }else{ req.setAttribute("user", name); req.setAttribute("listblocks", list); return "login"; } } @RequestMapping("/regist.htm") public String Regis(String name,String password,HttpServletRequest req){ if(name.equals(null)){ req.setAttribute("str", "用户名和密码不能为空!"); }else{ if(us.Regist(name, password).equals("该用户已经存在!")){ req.setAttribute("str", "该用户已经存在!"); }else{ req.setAttribute("str", "注册成功请登录!"); } } return "index"; } }

zjjhzjb LV14
2023年9月19日
1529860026 LV24
2022年10月8日
快乐男孩 LV6
2021年6月1日
panda猫儿 LV2
2021年5月14日
zoujialuo LV9
2020年8月12日
newstu1981 LV1
2020年6月12日
2187693636 LV12
2020年4月10日
风萧萧兮易水寒雨 LV2
2019年9月18日
chj198795 LV7
2019年8月7日
black-shuai LV6
2019年6月22日