1
我想允許登錄用戶訪問頁面並自動檢索分配給它們的模塊。爲此,我使用了@PathVariable和id作爲值。彈出錯誤 - 找不到具有URI的HTTP請求映射
我控制器
@RequestMapping(value="/main/user/setter/settingpage/{id}", method =
RequestMethod.GET)
public String showStaffModules(@PathVariable("id") Integer id, ModelMap map,
HttpServletRequest request) {
map.addAttribute("cp", request.getContextPath());
map.addAttribute("Setter", userService.getWithModules(id));
return "/main/user/setter/settingpage";
到目前爲止,雖然錯誤持續上來:
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP
request with URI [/app/main/user/setter/settingpage] in DispatcherServlet with
name 'appServlet'
被請求是在正確的位置,但它沒有被返回的頁面。有人會知道爲什麼嗎?謝謝。
錯誤消息非常明顯。你試圖向這個URL發送一個請求 - 「/ app/main/user/setter/settingpage」,而你的控制器中的請求實際上被映射到這個URL - '/ main/user/setter/settingpage/10 '這確實不可用。採取URL映射。 – Lion 2013-05-03 18:27:53
是的,我想uri返回與最後附加的用戶的id,但我添加了另一個請求映射沒有id。感謝您的評論。 – user2259555 2013-05-03 19:49:29