首页>代码>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";
            }
        }

    }
最近下载更多
少时诵诗书dddddd  LV2 2023年12月22日
GJZZHDFS  LV2 2023年6月25日
微信网友_6515044842917888  LV1 2023年6月11日
buling-  LV1 2023年6月8日
小妹妹  LV7 2023年5月22日
女王不该在山炮村养花  LV8 2023年4月17日
六加蛙  LV1 2023年3月15日
李亮  LV19 2023年3月5日
微信网友_6285674400206848  LV1 2022年12月31日
renyuan  LV9 2022年12月6日
最近浏览更多
沈从文  LV2 1月1日
微信网友_6791276179181568 2023年12月23日
暂无贡献等级
少时诵诗书dddddd  LV2 2023年12月22日
shuangfu  LV24 2023年12月2日
微信网友_6753981327003648 2023年11月27日
暂无贡献等级
感觉啊安排 2023年11月5日
暂无贡献等级
mds123456  LV2 2023年11月2日
logitch  LV1 2023年10月12日
1289755  LV3 2023年7月29日
GJZZHDFS  LV2 2023年6月25日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友