02_用户模块和加入样式
1 复制静态文件到当前工程
2 拷贝index.jsp ,完善里面的样式
3 添加命名空间mvc ,和放行各种静态文件:
<!-- 放行各种静态文件 这个是第一种方式,这里不好用,我们这里使用第二种方式,在web.xml里面配置 -->
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd">
<context:component-scan base-package="cn.hd.controller"></context:component-scan>
<!-- 放行各种静态文件 -->
<mvc:resources location="/assets/**" mapping="/assets/" cache-period="12345"></mvc:resources>
<mvc:resources location="/Css/**" mapping="/Css/" cache-period="12345"></mvc:resources>
<mvc:resources location="/front/**" mapping="/front/" cache-period="12345"></mvc:resources>
<mvc:resources location="/Images/**" mapping="/Images/" cache-period="12345"></mvc:resources>
<mvc:resources location="/Js/**" mapping="/Js/" cache-period="12345"></mvc:resources>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
</beans>
第二种方式:在web.xml里面配置 放行:
<!-- 第二种方式:放行各种静态文件 -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
4 修改首页index.jsp ,修改userList.jsp
运行测试:
样式集成成功!!
其它请看附件。
分享到:
相关推荐
主要介绍了浅谈Spring Security 对于静态资源的拦截与放行,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
狂神spring-security静态资源.zip
我们使用Spring Boot编写多个模块开发时,我们希望各个模块使用各自的配置文件,避免将整个项目的配置文件都写在一起,从而降低各个模块之间的耦合度。
结合spring框架实现的静态代理,接口回掉
spring-security静态资源
Spring专题与案例 Spring代理 静态代理和动态代理 Spring专题与案例-代理(静态和动态) Spring专题与案例-代理(静态和动态)
SpringCloud分布式微服务项目Common通用依赖模块抽离示例代码 SpringCloud分布式微服务项目Common通用依赖模块抽离示例代码 SpringCloud分布式微服务项目Common通用依赖模块抽离示例代码 SpringCloud分布式微服务...
来自于狂神Spring Security
狂神说SpringSecurity静态资源.rar
SpringSecurity项目的静态资源
后台_用户模块1. 后台管理员用户登录/manage/user/login.do,POST请求,表单中需要提交 username 和 password 字段非管
Maven构建全栈式Flex、BlazeDS和Spring集成解决方案–第一部分_创建Maven_Flex模块
spring boot静态资源部署Spring Boot 是由 Pivotal 团队提供的全新框架,其设计目的是用来简化新 Spring 应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。
spring ioc模块手写demospring ioc模块手写demospring ioc模块手写demospring ioc模块手写demospring ioc模块手写demospring ioc模块手写demospring ioc模块手写demospring ioc模块手写demospring ioc模块手写demo...
17.硅谷学习_SpringCloud_Rest微服务案例-API公共模块和部门Entity步骤 18.硅谷学习_SpringCloud_Rest微服务案例-部门服务提供者 19.硅谷学习_SpringCloud_Rest微服务案例-部门服务消费者 20.硅谷学习_Spring...
使用springcloud的负载均衡 以及网关 实现文件的上传处理参看链接 https://blog.csdn.net/zhaoyu_nb/article/details/80579918
heima spring source code day 02
Spring02_工厂模式与Spring入门.zip
Spring Web Reactive 在 spring-webmvc 模块中现有的(而且很流行)Spring Web MVC旁边的新的 spring-web-reactive 模块中。 请注意,在 Spring5 中,传统的 SpringMVC 支持 Servlet3.1 上运行,或者支持 JavaEE7 的...