首页>代码>spring+mybatis+memcached简单整合的项目demo>/springmvc_mybatis_memcached/src/it/shb/ssm/controller/UserController.java
package it.shb.ssm.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import it.shb.ssm.po.User;
import it.shb.ssm.service.impl.IUserService;

@Controller
@RequestMapping("/user")
public class UserController {
  @Resource
  private IUserService userService;
  
  @RequestMapping("/showUser")
  public ModelAndView toIndex(HttpServletRequest request,
		  HttpServletResponse response)throws Exception{
	  
	 //创建 ModelAndView 对象,showUser 为返回的 jsp 页面的名称,全路径是根据在
	 //springMVC 配置文件中配置的前缀与后缀拼接而成
	  ModelAndView model= new ModelAndView("showUser");
	  User user=userService.getUser("xiaohong");
	  //将对象加入 mode 返回到前台页面
	  model.addObject("user", user);
	  return model;
  }
}
最近下载更多
执行中  LV7 2019年5月20日
1943815081  LV13 2019年1月2日
虫儿飞  LV4 2018年10月11日
sss师122  LV3 2018年9月19日
wcy071213  LV27 2018年6月2日
leoxxxx  LV11 2018年5月17日
Ceterniy  LV9 2018年5月8日
weiwei03147  LV3 2018年4月24日
元芳你怎么看  LV15 2018年1月26日
oceanchen  LV14 2017年12月29日
最近浏览更多
sdhfkh  LV4 2023年6月12日
gw0207  LV13 2023年4月26日
李亮  LV19 2023年3月6日
crosa_Don  LV18 2023年2月10日
Sunsi12345  LV8 2022年12月2日
zhiwei0127  LV1 2022年11月6日
5212991314 2022年10月26日
暂无贡献等级
谢谢谢谢谢谢你  LV6 2022年7月19日
采暖11  LV11 2021年11月23日
ccaozzhen  LV1 2021年6月30日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友