package com.welljoint.rest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.welljoint.entity.User;
import com.welljoint.service.LoginService;
/**
* @version
* @describe:控制器
*/
@Controller //注解为控制器
@RequestMapping(value="/login") //截获带有/login的请求
public class LoginController {
@Autowired
LoginService loginService; //注入service层
@RequestMapping(method=RequestMethod.GET)
public String get(){ //用来返回一个页面
return "login"; //返回指向login.jsp页面
}
@RequestMapping(method=RequestMethod.POST)
public String post(User user){ //用来处理用户的登陆请求
if (loginService.login(user.getUserName(), user.getPassword())==1) {
return "login_success"; //登陆成功,跳转到login_success.jsp页面
}
return "login";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
spring+springmvc+Mybatis登陆的例子
共40个文件
xml:14个
java:5个
class:5个
需积分: 9 7 下载量 144 浏览量
2018-03-08
17:27:34
上传
评论 1
收藏 22KB RAR 举报
温馨提示
使用spring+springmvc+Mybatis登陆的例子,详细教程请看http://blog.csdn.net/tiandixuanwuliang/article/details/79482432
资源推荐
资源详情
资源评论
收起资源包目录
testSSM2.rar (40个子文件)
testSSM2
.project 1KB
WebContent
WEB-INF
view
login.jsp 542B
login_success.jsp 362B
lib
web.xml 2KB
META-INF
MANIFEST.MF 39B
src
test
main
webapp
resources
Mapper
UserMapper.xml 402B
conf.properties 175B
spring-mybatis.xml 3KB
spring-mvc.xml 2KB
spring.xml 1KB
logback.xml 2KB
java
com
welljoint
service
LoginService.java 126B
LoginServiceImpl.java 491B
dao
UserDao.java 349B
entity
User.java 807B
rest
LoginController.java 1KB
target
m2e-wtp
web-resources
META-INF
MANIFEST.MF 114B
maven
com.welljoint
testSSM2
pom.properties 211B
pom.xml 5KB
classes
Mapper
UserMapper.xml 402B
conf.properties 175B
spring-mybatis.xml 3KB
com
welljoint
service
LoginServiceImpl.class 998B
LoginService.class 185B
dao
UserDao.class 424B
entity
User.class 1KB
rest
LoginController.class 1KB
spring-mvc.xml 2KB
spring.xml 1KB
logback.xml 2KB
test-classes
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.m2e.core.prefs 90B
org.eclipse.jdt.core.prefs 430B
org.eclipse.wst.validation.prefs 50B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.component 576B
.jsdtscope 639B
pom.xml 5KB
.classpath 1KB
共 40 条
- 1
资源评论
天地炫舞
- 粉丝: 210
- 资源: 29
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功