Я знаю, что в stackoverflow есть тема о статическом контенте в Spring Web-приложении, но после прочтения его 5 и множества попыток я все еще не вижу своего содержимого страница. Я думаю, что у меня есть правильный путь в моем файле jsp. Моя структура проекта швы, как показано ниже:Использование CSS и JS в весеннем веб-проекте
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page contentType="text/html; charset=ISO-8859-1"%>
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<c:url value = '/css/stylesheet.css' />" />
<script type="text/javascript" src="<c:url value = '/js/restful.js' />"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Snore-O-Meter</title>
</head>
<body>
<a href="javascript:HelloWorld()">Hello</a>
</body>
</html>
Но я думаю, что что-то в значениях web.xml или MVC-диспетчерский-servlet.xml по умолчанию:
web.xml
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring MVC Application</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
MVC-диспетчерская-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" 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
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<context:component-scan base-package="com.springapp.mvc"/>
<mvc:annotation-driven />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
Спасибо за любую помощь, я знаю, что это мое невежество в тему, но у меня было 2 книги о Spring, и я не могу найти любую полезную информацию по этой теме, и мне действительно нужно рабочее реальное приложение к узнать весну и создать веб-приложение.
Спасибо, что помогли мне – Mazeryt