springMVC中可以自定义类型转换器,以便参数以需要的格式进行绑定
<mvc:annotation-driven conversion-service="conversionServiceFactory"></mvc:annotation-driven>
<bean id="conversionServiceFactory" class="org.springframework.context.support.ConversionServiceFactoryBean">
<property name="converters" >
<set>
<bean class="controller.StringToDateConversion"></bean>
</set>
</property>
</bean>
解析WEB-INF 内资源时配置内部资源解析器(框架提供)及参数
<bean id="InternalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
放行前端资源
<mvc:resources mapping="/js/**" location="/js"></mvc:resources>
配置多部分文件解析器以上传文件
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!--1024*1024*5=5242880 5M-->
<property name="maxUploadSizePerFile" value="5242880"></property>
</bean>
配置异常解析器(自定义),配置拦截器(自定义)
<bean id="springExceptionHandel" class="controller.SpringExceptionHandel"></bean>
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/user"/>
<bean class="controller.MyInterceptor"></bean>
</mvc:interceptor>
</mvc:interceptors>