SSM整合
-
修改web.xml文件
<!-- Spring配置 spring容器,dao,service层--> <!-- 当系统启动的时候,spring需要进行一些资源加载或者配置,都需要使用此监听去做 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml</param-value> </context-param> <!-- spring容器--> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
SpringMVC访问静态文件
<!--静态资源--> <mvc:resources mapping="/statics/**" location="/statics/"/>
mapping:将静态资源映射到指定的路径下 location:本地静态资源文件所在的目录
数据格式化
-
实现方式
-
接口方式:org.springframework.format.Formatter
-
注解方式:org.springframework.format.AnnotationFormatterFactory
-
-
内置API
-
@DateTimeFormat
-
@NumberFormat
-
-
全局注册
-
Java configuration
-
XML-based configuration
-
<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
<property name="registerDefaultFormatters" value="false" />
<property name="formatters">
<set>
<bean class="org.springframework.format.number.NumberFormatAnnotationFormatterFactory" />
<bean class="org.springframework.format.datetime.DateFormatter" p:pattern="yyyy