2016-03-31 7 views
0

ich bin webjars im Frühjahr mvc mit der gleichen Konfiguration verwendet wie docs webjars, aber wenn ich diese Zeile i für alle Seiten 404 Fehler bekam:webjars bloc alle meine Seiten (Spring MVC und Maven-Projekt)

mvc: Ressourcen-Mapping = "/ webjars/**" location = "/ webjars /"

was ist das Problem bitte ??

Teil von pom.xml:

<!-- webJars --> 
<dependency> 
    <groupId>org.webjars</groupId> 
    <artifactId>materializecss</artifactId> 
    <version>0.97.5</version> 
</dependency> 
<dependency> 
    <groupId>org.webjars</groupId> 
    <artifactId>jquery</artifactId> 
    <version>2.2.2</version> 
</dependency> 

<!-- spring --> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-core</artifactId> 
    <version>4.2.5.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-webmvc</artifactId> 
    <version>4.2.5.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-context</artifactId> 
    <version>4.2.5.RELEASE</version> 
</dependency> 

Teil von Dispatcher-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:mvc="http://www.springframework.org/schema/mvc" 
xmlns:context="http://www.springframework.org/schema/context" 
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd 
    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.2.xsd"> 

<context:component-scan base-package="controllers" /> 

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
    <property name="prefix" value="/WEB-INF/views/" /> 
    <property name="suffix" value=".jsp" /> 
</bean> 

<mvc:resources mapping="/webjars/**" location="/webjars/"/> 

Teil von web.xml

<web-app> 

<display-name>Archetype Created Web Application</display-name> 

<!-- The front controller of this Spring Web application, responsible for handling all application requests --> 
<servlet> 
    <servlet-name>dispatcher</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
</servlet> 

<!-- Map all requests to the DispatcherServlet for handling --> 
<servlet-mapping> 
    <servlet-name>dispatcher</servlet-name> 
    <url-pattern>/</url-pattern> 
</servlet-mapping> 

<!-- needed for ContextLoaderListener --> 
<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>/WEB-INF/dispatcher-servlet.xml</param-value> 
</context-param> 

<!-- Bootstraps the root web application context before servlet initialization --> 
<listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener> 

und die jsp:

<head> 
<title>log in</title> 

<link rel="stylesheet" href="/webjars/materialize/0.97.5/css/materialize.min.css"> 
</head> 
<body> 

<div class="row"> 
    <form class="col s12"> 
     <div class="row"> 
     <div class="input-field col s6"> 
      <input placeholder="Placeholder" id="first_name" type="text" class="validate"> 
      <label for="first_name">First Name</label> 
     </div> 
     </div> 
    </form> 
    </div> 

    <!-- Compiled and minified JavaScript --> 
    <script src="webjars/materialize/0.97.5/js/materialize.min.js"></script> 
    <script src="webjars/jquery/2.2.2/jquery.min.js"></script> 
</body> 

Antwort