我是spring mvc的新手,我正在尝试构建一个Java Web应用程序。 以下是我得到的错误:
1:14:11.411 [http-nio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/template/layout/styles/layout.css]
01:14:11.412 [http-nio-8080-exec-10] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/template/layout/styles/layout.css] in DispatcherServlet with name 'spring-mvc'
01:14:11.412 [http-nio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.413 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/480x360.png]
01:14:11.414 [http-nio-8080-exec-8] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/480x360.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.414 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.420 [http-nio-8080-exec-2] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.min.js]
01:14:11.421 [http-nio-8080-exec-2] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.min.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.421 [http-nio-8080-exec-2] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.425 [http-nio-8080-exec-7] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.backtotop.js]
01:14:11.426 [http-nio-8080-exec-7] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.backtotop.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.426 [http-nio-8080-exec-7] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.430 [http-nio-8080-exec-1] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.mobilemenu.js]
01:14:11.430 [http-nio-8080-exec-1] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.mobilemenu.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.430 [http-nio-8080-exec-1] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.436 [http-nio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/100x100.png]
01:14:11.436 [http-nio-8080-exec-3] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/100x100.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.436 [http-nio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.441 [http-nio-8080-exec-5] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/320x220.png]
01:14:11.441 [http-nio-8080-exec-5] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/320x220.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.441 [http-nio-8080-exec-5] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.462 [http-nio-8080-exec-6] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.min.js]
01:14:11.463 [http-nio-8080-exec-6] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.min.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.463 [http-nio-8080-exec-6] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.474 [http-nio-8080-exec-4] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/backgrounds/01.png]
01:14:11.474 [http-nio-8080-exec-4] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/backgrounds/01.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.474 [http-nio-8080-exec-4] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.482 [http-nio-8080-exec-9] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/backgrounds/02.png]
01:14:11.483 [http-nio-8080-exec-9] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/backgrounds/02.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.483 [http-nio-8080-exec-9] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.498 [http-nio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/images/demo/backgrounds/03.png]
01:14:11.499 [http-nio-8080-exec-10] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/images/demo/backgrounds/03.png] in DispatcherServlet with name 'spring-mvc'
01:14:11.499 [http-nio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.583 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.backtotop.js]
01:14:11.584 [http-nio-8080-exec-8] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.backtotop.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.584 [http-nio-8080-exec-8] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
01:14:11.601 [http-nio-8080-exec-2] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-mvc' processing GET request for [/TooO/layout/scripts/jquery.mobilemenu.js]
01:14:11.602 [http-nio-8080-exec-2] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/TooO/layout/scripts/jquery.mobilemenu.js] in DispatcherServlet with name 'spring-mvc'
01:14:11.602 [http-nio-8080-exec-2] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
** web.xml:**
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<display-name>TooO</display-name>
<welcome-file-list>
<welcome-file>welcome.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
&#13;
我的spring-mvc-servlet.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<import resource="classpath:config/user-beans.xml" />
<context:component-scan base-package="spring.mvc" />
<context:annotation-config />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
我的welcome.jsp
:
<!DOCTYPE html>
<html lang="en">
<!-- To declare your language - read more here: https://www.w3.org/International/questions/qa-html-language-declarations -->
<head>
<title>TooO | New Smoking Experience1</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="template/layout/styles/layout.css" rel="stylesheet" type="text/css" media="all">
</head>
我已在welcome.jsp
中将web.xml
设置为欢迎文件,而在welcome.jsp
中,我使用template/layout/styles/layout.css
作为样式表,但是,当我运行该程序时并打开网页,未在网页中设置样式。但是layout.css
的路径是正确的,我想知道我在servlet文件中设置的解析器是否设置不正确。
例如,在控制台中显示的第一个错误中:
1:14:11.411 [http-nio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - 名称为&#39; spring-mvc&#39;的DispatcherServlet处理[/TooO/template/layout/styles/layout.css]的GET请求 01:14:11.412 [http-nio-8080-exec-10] WARN osweb.servlet.PageNotFound - 在DispatcherServlet中找不到带有URI [/TooO/template/layout/styles/layout.css]的HTTP请求的映射名称&#39;弹簧-MVC&#39;
这说它无法找到layout.css
文件。