2015-10-27 14 views
0

Я пытаюсь добавить загрузчик и JQuery через webjars зависимостей
я добавил следующие строки в моем JSP:Spring проблема с интеграцией webjar

<link rel='stylesheet' href='/webjars/bootstrap/3.3.5/css/bootstrap.min.css'> 
<script type="text/javascript" src="/webjars/bootstrap/3.3.5/js/bootstrap.min.js"></script> 
<script type="text/javascript" src="/webjars/jquery/2.1.4/jquery.min.js"></script> 

И моя весна-диспетчерская-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:tx="http://www.springframework.org/schema/tx" 
xmlns:context="http://www.springframework.org/schema/context" 
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd 
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd  
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> 

<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/> 
<context:component-scan base-package="com.meltum.*" /> 

<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"> 
    <property name="definitions"> 
    <list> 
     <value>/WEB-INF/tiles-def.xml</value> 
    </list> 
    </property> 
</bean> 

<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> 
    <property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/> 
</bean> 

Когда я извлекаю: MVC линии ресурсов в моем XML страница работает еще я получаю 404 страниц. У кого-нибудь есть идея для моей проблемы?

+0

вы используете совместимый контейнер сервлетов 3? –

+0

@JamesWard Чтобы быть честным, я не знаю, что это значит, но, возможно, не –

+0

@JamesWard, если вы говорите о сервлете javax зависимости (я видел в Google, что он ссылается на это), я могу показать вам зависимость, которую я надел project –

ответ

0

Я только что изменил версию с 3,1 до 4,0 в моем весенне-диспетчерском-servlet.xml и поставить MVC: ресурсы в конце и MVC: аннотация привода после

моей весны-диспетчерской-сервлета .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:tx="http://www.springframework.org/schema/tx" 
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.0.xsd 
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd  
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> 

<context:component-scan base-package="com.meltum" /> 

<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"> 
    <property name="definitions"> 
    <list> 
     <value>/WEB-INF/tiles-def.xml</value> 
    </list> 
    </property> 
</bean> 

<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> 
    <property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/> 
</bean> 

<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/> 
<mvc:annotation-driven></mvc:annotation-driven> 

Смежные вопросы