首页>代码>SSM框架之简单用户登录实现实例>/LWH01/src/main/java/com/lwh/controller/UserController.java
package com.lwh.controller;

import com.lwh.pojo.User;
import com.lwh.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {

        @Autowired
        UserService userService;

        @RequestMapping("/login")
        public String elogin(HttpServletRequest request){
            String loginname = request.getParameter("name");
            String loginpass = request.getParameter("password");
            User user = new User();
            user.setUsername(loginname);
            user.setPassword(loginpass);

            User userLogin = userService.getLogin(user);
            if(userLogin!=null){
                return "success";
            }else{
                return "error";
            }
        }

    }
最近下载更多
zhoubowen  LV3 2024年12月29日
cnzy00  LV1 2024年12月11日
zczcccc  LV1 2024年10月11日
sjsjsjjd  LV1 2024年6月17日
xinleixie  LV1 2024年6月13日
少时诵诗书dddddd  LV2 2023年12月22日
GJZZHDFS  LV2 2023年6月25日
微信网友_6515044842917888  LV1 2023年6月11日
buling-  LV1 2023年6月8日
最近浏览更多
正常发挥 6月30日
暂无贡献等级
暂无贡献等级
xiaoaitx  LV8 1月1日
zhoubowen  LV3 2024年12月29日
cnzy00  LV1 2024年12月11日
zczcccc  LV1 2024年10月11日
TY0165  LV20 2024年6月24日
qiwwwww  LV2 2024年6月20日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友