我有這個類在我的Spring Web模型 - 視圖 - 控制器(MVC)框架映射。 Spring Web模型 - 視圖 - 控制器(MVC)框架的版本是3.2.8。Spring MVC的:警告:未找到HTTP請求的URI與
我有這個web.xml文件。
...
<servlet-mapping>
<servlet-name>ecolabelWeb</servlet-name>
<url-pattern>*.do</url-pattern>
<url-pattern>/newdesign/manage/manageapplications</url-pattern>
<url-pattern>/newdesign/manage/manageapplications/</url-pattern>
<url-pattern>/newdesign/manage/manageapplications/*</url-pattern>
<url-pattern>/newdesign/manage/home</url-pattern>
<url-pattern>/newdesign/manage/home/</url-pattern>
<url-pattern>/newdesign/manage/home/*</url-pattern>
<!-- Explicitly mention /welcome.do for usage as welcome page -->
<url-pattern>/welcome/welcome.do</url-pattern>
</servlet-mapping>
...
與此控制器:
/**
*
*/
@RequestMapping(value = { "/newdesign/manage/home",
"/newdesign/manage/home/",
"/newdesign/manage/manageapplications",
"/newdesign/manage/manageapplications/"}, method = {RequestMethod.GET})
public String manageApplications (@ModelAttribute("aplicationListForm") final AplicationListForm aplicationListForm,
HttpServletRequest request,
Model model) throws ExecutionException {
User sessionUser = (User)request.getSession().getAttribute(Const.SESSION_USER);
..
}
這個URL工作正常
/newdesign/manage/manageapplications
,但與這一個newdesign/manage/home
我得到這個錯誤
WARNING: No mapping found for HTTP request with URI [/devices/newdesign/manage/home]
我真的變瘋了!
我也試圖把它的另一種方法具有相同的結果
@RequestMapping(value = { "/newdesign/manage/home",
"/newdesign/manage/home/"}, method = {RequestMethod.GET})
public String cbHome (Model model) throws ExecutionException {
..
}
此URL工作 http://127.0.0.1:7001/devices/newdesign/manage/manageapplications 沒有這一項(?!) http://127.0.0.1:7001/devices/newdesign/manage/home
設備是你的應用程序上下文? – vincent
是:http://127.0.0.1:7001/devices/newdesign/manage/home –
你不應該你的servlet映射到控制器的URL。默認情況下,映射是在調度程序servlet的映射內完成的。在'/ newdesign/manage/home'旁邊已經暗示'/ newdesign/manage/home /'。您應該將您的servlet映射到'/'或'/ *'以使其工作或配置您的請求映射以使用完整的url而不是最後一部分。 –