SpringMVC同時使用和日期轉換Formatter時出現問題的解決方法
配置了
<mvc:annotation-driven conversion-service="conversionService" />
<bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
<property name="converters">
<set>
<bean class="com.ixiongyu.controller.converter.StringToDateConverter" >
<constructor-arg name="datePattern" value="yyyy-MM-dd"/>
</bean>
</set>
</property>
</bean>
想將字串轉成Date的時候,出現錯誤:
Failed to convert from type [java.util.ArrayList<?>] totype[java.util.List<org.springframework .core.io.Resource>]
解決方案:
將
<mvc:resources mapping="/js/**" location="/js/"/>
<mvc:resources mapping="/css/**" location="/css/"/>
<mvc:resources mapping="/img/**" location="/img/"/>
改為
<mvc:default-servlet-handler/>
就ok,意思就是沒有對映到的URL交給預設的web容器中的servlet進行處理
我的個人部落格地址