org.springframework.web.servlet.PageNotFound noHandlerFound-发送参数时出错
我们有以下情况org.springframework.web.servlet.PageNotFound noHandlerFound-发送参数时出错,spring,jsp,servlets,Spring,Jsp,Servlets,我们有以下情况 <a href="<c:url value="/inventory"/>">Example 1</a> <a href="<c:url value="/inventory/?type=removed"/>">Example 2</a> “示例1”效果很好,但如果我单击“示例2”,则会生成如下错误 org.springframework.web.servlet.PageNotFound noH
<a href="<c:url value="/inventory"/>">Example 1</a>
<a href="<c:url value="/inventory/?type=removed"/>">Example 2</a>
“示例1”效果很好,但如果我单击“示例2”,则会生成如下错误
org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/exampleproject/inventory/resources/js/jquery.js] in DispatcherServlet with name 'spring'
当然,错误适用于所有资源,如css、javascripts等
除了任何网页之外,我还使用
原因可能是什么?应该是
@RequestMapping(value = "/inventory", method = RequestMethod.GET)
public String printInventoryPage(...)
并在?
<a href="<c:url value="/inventory?type=removed"/>">Example 2</a>
您在“/inventory/?type=removed”中的URI末尾额外添加了一个
/
。只需写“/库存?类型=已删除”
将控制器方法映射到“库存”。IMHO将其映射到“/库存”更为正确。但是“/inventory/”是另一个URL
如果出于任何原因,您需要该方法同时回答这两个问题,请以这种方式声明:
@RequestMapping(value = {"/inventory", "/inventory/"}, method = RequestMethod.GET)
public String printInventoryPage( ...
@RequestMapping(value = {"/inventory", "/inventory/"}, method = RequestMethod.GET)
public String printInventoryPage( ...