首页>代码>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日
最近浏览更多
dane168  LV8 2月17日
chinajy  LV2 2024年12月8日
ss44dd55 2024年8月26日
暂无贡献等级
微信网友_6927932988952576  LV12 2024年3月31日
zolscy  LV24 2024年3月24日
smart001 2024年1月6日
暂无贡献等级
yshysh123 2023年9月20日
暂无贡献等级
zjjhzjb  LV14 2023年9月19日
1997akkk  LV5 2023年7月5日
include  LV8 2023年6月20日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友