Spring未使用Spring安全性加载CSS和js
我是Spring MVC的新手。我创建了一个包含样式和客户端验证的登录页面。部署project后,我看到的登录页面没有任何样式和验证。我怎样才能解决这个问题?我已经提供了我的项目结构、部署描述符和spring配置文件 我使用Spring未使用Spring安全性加载CSS和js,spring,spring-mvc,spring-security,Spring,Spring Mvc,Spring Security,我是Spring MVC的新手。我创建了一个包含样式和客户端验证的登录页面。部署project后,我看到的登录页面没有任何样式和验证。我怎样才能解决这个问题?我已经提供了我的项目结构、部署描述符和spring配置文件 我使用配置静态内容,比如img、css、js Web.xml 弹簧配置 org.springframework.web.servlet.DispatcherServlet 1. 弹簧配置 / springSecurityFilterChain org.springframew
配置静态内容,比如img、css、js
Web.xml
弹簧配置
org.springframework.web.servlet.DispatcherServlet
1.
弹簧配置
/
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
org.springframework.web.context.ContextLoaderListener
上下文配置位置
/WEB-INF/应用程序上下文*.xml
`
spring config servlet.xml
应用程序上下文.xml谢谢Srikanth 资源文件夹结构存在问题。我已将资源文件夹重新构造为 资源
--css
--js
--图像
在此更改后,我的页面已正确加载。能否显示如何在jsp文件中包含css、js引用。如果mvc:resources映射为“/resources/**”,则应在jsp中包含css、js文件
<servlet>
<servlet-name>spring-config</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-config</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/application-context*.xml</param-value>
</context-param>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:component-scan base-package="org.fms"/>
<mvc:annotation-driven/>
<mvc:resources mapping="/Resources**" location="/Resources/"/>
<!--View Resolver Configuration-->
<bean id="viewResolver1" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
<property name="order" value="1"/>
<property name="basename" value="view"/>
</bean>
<bean id="viewResolver2"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="order" value="2"/>
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>