package controller;
import javax.annotation.Resource;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import service.PersonService;
import tools.MD5Tools;
@Controller
public class LoginController {
@Resource
private PersonService personService;
static Logger logger = Logger.getLogger(LoginController.class); //LogDemo为相关的类
@RequestMapping("/login.html")
public String login(@RequestParam(value="name",required=false)String name,
@RequestParam(value="password",required=false)String password){
if(name != null && password !=null){
//使用Md5加密
String md5 = MD5Tools.getMD5(password);
boolean adminLogin = personService.adminLogin(name, md5);
if(adminLogin){
logger.debug("登陆成功");
return "admin/main";//跳转
}
}
logger.debug("登陆失败");
return "redirect:login.jsp";
}
@RequestMapping("/index.html")
public String index(){
logger.debug("跳转到index");
return "redirect:index.jsp";
}
}
最近下载更多
微信网友_7134912998903808 LV15
2024年8月29日
jskdbf LV7
2022年6月11日
lilong007 LV23
2021年12月22日
success1011 LV8
2021年12月15日
双方各何必呢 LV13
2021年12月10日
桐姥爷无敌呀 LV4
2021年11月15日
dxadsaf LV6
2021年10月7日
15167672991 LV6
2021年6月29日
凉筱123 LV2
2021年5月29日
xiaoxiexie LV13
2021年4月26日
最近浏览更多
奋斗的小蚂蚁 LV17
10月28日
talete LV3
2月14日
ma406805131 LV19
2024年12月18日
微信网友_7134912998903808 LV15
2024年8月29日
try8023 LV19
2024年6月7日
1134116035
2024年2月28日
暂无贡献等级
heshao LV2
2024年2月7日
PSSDZH LV3
2023年12月26日
zhaozhiqi LV5
2023年10月10日
yeyuuu LV6
2023年5月18日

