[英]Org.springframework.web.servlet.dispatcherservlet nohandler found no mapping found
I know that this question has been a many times, and i tried a lot, but it doesn't work. 我知道这个问题已经很多次了,我尝试了很多,但是没有用。 I have some errors and i don't know exactly what to do with them. 我有一些错误,我不知道该怎么办。 The server looks like is not recognizing the css files and the javascript files that are define in the jsp files. 服务器似乎无法识别jsp文件中定义的css文件和javascript文件。
web.xml web.xml中
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" id="WebApp_ID"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<display-name>spring-mvc-crud-demo</display-name>
<welcome-file-list>
<welcome-file>Index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-mvc-crud-demo-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
servlet.xml servlet.xml中
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- Add support for component scanning -->
<context:component-scan base-package="com.controller" />
<!-- Add support for conversion, formatting and validation support -->
<mvc:annotation-driven />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WebContent/" />
<property name="suffix" value=".jsp" />
</bean>
Controller 调节器
package com.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping(value= "/intent", method= RequestMethod.POST)
public class IntentController {
@RequestMapping("/notepad")
public String Notepad(){
System.out.println("Notepad is redy");
return "Index";
}
The error The server does not see the css files and the javascript. 错误服务器看不到css文件和javascript。
Sep 21, 2017 11:32:06 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/ApiAi/assets/css/noscript.css] in DispatcherServlet with name 'dispatcher'
Sep 21, 2017 11:32:06 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/ApiAi/assets/js/jquery.min.js] in DispatcherServlet with name 'dispatcher'
Sep 21, 2017 11:32:06 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/ApiAi/assets/css/mainCss.css] in DispatcherServlet with name 'dispatcher'
Sep 21, 2017 11:32:06 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/ApiAi/assets/js/skel.min.js] in DispatcherServlet with name 'dispatcher'
Sep 21, 2017 11:32:06 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/ApiAi/assets/js/util.js] in DispatcherServlet with name 'dispatcher'
Sep 21, 2017 11:32:06 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/ApiAi/assets/js/main.js] in DispatcherServlet with name 'dispatcher'
Sep 21, 2017 11:32:06 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/ApiAi/images/pic03.jpg] in DispatcherServlet with name 'dispatcher'
Project structure would have been helpful to give exact answer. 项目结构将有助于给出确切的答案。 Though this may not be working because you have not provided the resource mapping in your servlet.xml file. 尽管这可能不起作用,因为您没有在servlet.xml文件中提供资源映射。 Try again by providing proper resource path mapping using the following tag 通过使用以下标记提供正确的资源路径映射来重试
<mvc:resources mapping="/resources/**" location="/<your_path>" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.