我创建了一个包含外部CSS文件的页面。我无法使用我的jsp页面对我的css文件进行mapp。相同的代码在netbeans中工作正常,但在Sprint Tool Suite(eclipse)中引起问题。
的web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>sk</servlet-name>
<servlet-class>org.springfamework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>sk</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
分配器一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: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-4.3.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
<context:annotation-config></context:annotation-config>
<mvc:resources mapping="/resources/**" location="/resources/" />
<context:component-scan base-package="com.sk"></context:component-scan>
</beans>
JSP页面
<%@page contentType="text/html" language="java" pageEncoding="UTF-8"%>
<html>
<head>
<meta charset="UTF-8">
<title>Contact and Feedback</title>
<link rel="stylesheet" href="resources/css/style.css" media="all" type="text/css">
</head>
<body>
<div id="background">
<div id="page">
<div id="header">
<div id="logo">
<a href="index.html"><img src="images/logo.png" alt="LOGO" height="112" width="118"></a>
</div>
<div id="navigation">
<ul>
<li>
<a href="index.html">Home</a>
</li>
<li>
<a href="about.html">About</a>
</li>
<li>
<a href="videos.html">Videos</a>
</li>
<li>
<a href="images.html">Images</a>
</li>
<li>
<a href="downlaods.html">Downloads</a>
</li>
<li>
<a href="news.html">News</a>
</li>
<li class="selected">
<a href="contact.html">Contact</a>
</li>
</ul>
</div>
</div>
<div id="contents">
<div class="box">
<div>
<div id="contact" class="body">
<h1>Contact</h1>
<form action="addfeedback" method="post">
<table>
<tbody>
<tr>
<td>Name:</td>
<td><input type="text" value="" name="name" class="txtfield"></td>
</tr> <tr>
<td>Email:</td>
<td><input type="text" value="" name="mail" class="txtfield"></td>
</tr> <tr>
<td>Subject:</td>
<td><input type="text" value="" name="sub" class="txtfield"></td>
</tr> <tr>
<td class="txtarea">Message:</td>
<td><textarea name="msg"></textarea></td>
</tr> <tr>
<td></td>
<td><input type="submit" value="" class="btn"></td>
</tr>
</tbody>
</table>
</form>
<h2>Spring MVC Test Page</h2>
<p>
<span>Address:</span> Integral University Boys Hostel
</p>
<p>
<span>Contact Number:</span> +91-9479711997
</p>
<p>
<span>E-Mail ID</span> shahbaz275817@yahoo.com
</p>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<div>
<ul class="navigation">
<li>
<a href="index.html">Home</a>
</li>
<li>
<a href="about.html">About</a>
</li>
<li>
<a href="rooms.html">Videos</a>
</li>
<li>
<a href="dives.html">Images</a>
</li>
<li>
<a href="foods.html">Downloads</a>
</li>
<li>
<a href="news.html">News</a>
</li>
<li class="active">
<a href="contact.html">Contact</a>
</li>
</ul>
<div id="connect">
<a href="http://pinterest.com/fwtemplates/" target="_blank" class="pinterest"></a> <a href="http://freewebsitetemplates.com/go/facebook/" target="_blank" class="facebook"></a> <a href="http://freewebsitetemplates.com/go/twitter/" target="_blank" class="twitter"></a> <a href="http://freewebsitetemplates.com/go/googleplus/" target="_blank" class="googleplus"></a>
</div>
</div>
<p>
© 2017 by SHAHBAZ KHAN. All Rights Reserved
</p>
</div>
</div>
</body>
</html>