</welcome-file-list>
</web-app>
控制层UserController
package com.controller;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.entity.AcctUser;
import com.service.UserService;
@Controller
public class UserController {
private static final Logger LOGGER = Logger.getLogger(UserController.class);
@Autowired
private UserService userService;
@RequestMapping("/showInfo/{userId}")
public String showUserInfo(ModelMap modelMap, @PathVariable String userId){
LOGGER.info("查询用户:" + userId);
AcctUser userInfo = userService.load(userId);
modelMap.addAttribute("userInfo", userInfo);
return "/user/showInfo";
}
@RequestMapping("/showInfos")
public @ResponseBody List<AcctUser> showUserInfos(){
LOGGER.info("查询用户全部用户");
List<AcctUser> userInfos = userService.findAll();
return userInfos;
}
}
接下来。访问测试咯!!!!只是简单记录下,可能有些没有考虑周全
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-65857-16.html
西方列强普遍认为北阳水师可以轻松战胜日本海军