首页>代码>ssm使用redis做为spring+spring MVC+mybatis整合的二级缓存,基于maven搭建>/ssm-redis/src/main/java/com/ssm/controller/UserController.java
package com.ssm.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ssm.pojo.User;
import com.ssm.service.UserService;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
@Controller
public class UserController {
@Autowired
public UserService userService;
@RequestMapping(value = "/user")
public String getUserById(Model model, HttpServletRequest request) {
User user = userService.selectByPrimaryKey(1);
System.out.println(user+"----------------------------------------"+user.getPname());
model.addAttribute("cc", user);
request.getSession().setAttribute("u",user);
return "main";
}
}
最近下载更多
微信网友_7134912998903808 LV15
2024年9月13日
qq1466625431 LV6
2022年6月28日
wei_471416461 LV1
2022年6月25日
zz56zz LV1
2021年12月19日
m_x_x_k LV1
2021年12月7日
huangshaohua LV1
2021年12月1日
疯子庭 LV8
2021年11月30日
warrior09 LV2
2021年11月16日
奇了个怪 LV1
2021年11月15日
chenhong0223 LV1
2021年11月15日
最近浏览更多
3312djdad LV2
2024年11月11日
微信网友_7134912998903808 LV15
2024年9月13日
lun123456
2024年6月23日
暂无贡献等级
educationAAA LV11
2024年5月4日
yyh1252 LV8
2023年11月16日
c469893928 LV2
2023年6月10日
youwuzuichen LV11
2023年3月27日
不止是六位数 LV7
2023年3月21日
2237851964 LV1
2023年3月12日
banerwu LV3
2023年1月3日

