controller層接收前臺jsp路徑傳來的id的實現(/{id})/@RequestMapping("/findCorporationInfo/{id}")
阿新 • • 發佈:2018-12-14
jsp頁面:
<a href="${pageContext.request.contextPath}/corporation/findCorporationInfo/${sessionScope.user.id}" style="text-align: center">個人資料</a>
controller:
@RequestMapping("/corporation") @Controller public class UserCompleteController { @Resource private UserCompleteService userCompleteService; @RequestMapping("/findCorporationInfo/{id}") public String findCorporationInfo(@PathVariable Integer id, HttpSession session){ UserComplete userComplete = userCompleteService.findCorporationInfo(id); if(userComplete!=null){ session.setAttribute("userComplete",userComplete); return "/personal/findCorporationInfo"; } return ""; } }