Mario Hu
Mario Hu

Reputation: 77

how should I setting in spring-config.xml?

I use springmvc and my web.xml :

<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>

so I can't use the External file such as <link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">

My File structure is :enter image description here

I search a method is add this code in mvc-dispatcher-servlet.xml like this :<mvc:resources mapping="/assests/js/**" location="WEB-INF/pages/assets/"/> but it can't work! Is my path wrong?

Upvotes: 0

Views: 28

Answers (1)

Monzurul Shimul
Monzurul Shimul

Reputation: 8396

move your assets directory inside webapp directory and then change your configuration like this:

<mvc:resources mapping="/assests/js/**" location="/assets/js/" />

Upvotes: 2

Related Questions