package com.example.demo.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.example.demo.entity.User;
import com.example.demo.service.UserService;
@Controller
@RequestMapping("/user")
public class UserController {
@Resource
private UserService userService;
@RequestMapping("/showUser")
@ResponseBody
public User toIndex(HttpServletRequest request, Model model){
int userId = Integer.parseInt(request.getParameter("id"));
User user = this.userService.getUserById(userId);
return user;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
MyBoot.rar (33个子文件)
MyBoot
pom.xml 2KB
target
test-classes
com
example
demo
MyBootApplicationTests.class 628B
classes
META-INF
maven
com.example
MyBoot
pom.xml 2KB
pom.properties 225B
MANIFEST.MF 318B
application.yml 753B
com
example
demo
dao
UserDao.class 579B
MyBootApplication.class 796B
controller
UserController.class 1KB
service
UserService.class 299B
UserServiceImpl.class 1KB
entity
User.class 1KB
mapper
UserMapper.xml 3KB
mvnw 6KB
.settings
org.eclipse.m2e.core.prefs 97B
org.eclipse.wst.common.project.facet.core.xml 145B
org.eclipse.core.resources.prefs 155B
org.eclipse.jdt.core.prefs 356B
src
test
java
com
example
demo
MyBootApplicationTests.java 333B
main
resources
application.yml 753B
templates
static
mapper
UserMapper.xml 3KB
java
com
example
demo
dao
UserDao.java 413B
MyBootApplication.java 426B
controller
UserController.java 833B
service
UserServiceImpl.java 713B
UserService.java 190B
entity
User.java 828B
.project 1KB
.classpath 1KB
.gitignore 268B
.mvn
wrapper
maven-wrapper.jar 46KB
maven-wrapper.properties 110B
mvnw.cmd 5KB
共 33 条
- 1
资源评论
- zou_hailin2262021-04-25非常强大!给个赞!
- 流浪的邯郸2020-02-19有点坑 没跑,只有一个usercontroller,里面还只有一个显示方法,其他的啥都没有了,12分好坑,可惜了我的分了,能退回吗?哎
- ehtong2018-11-08起不起来,不能跑。。。缺少jar包。xiao___oaix2019-03-25不会maven嘛?pom.xml里有对应得jar依赖,有maven环境就可以了,会自动下
xiao___oaix
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功