oscache的下載地址
將jar包拷貝到項目的lib中
修改webxml文件加入如下幾行
<filter>
<filtername>encodingFilter</filtername>
<filterclass>
orgspringframeworkwebfilterCharacterEncodingFilter
</filterclass>
<initparam>
<paramname>encoding</paramname>
<paramvalue>UTF</paramvalue>
</initparam>
<initparam>
<paramname>forceEncoding</paramname>
<paramvalue>true</paramvalue>
</initparam>
</filter>
<filter>
<filtername>cacheFilter</filtername>
<filterclass>
comopensymphonyoscachewebfilterCacheFilter
</filterclass>
<initparam>
<paramname>time</paramname>
<paramvalue></paramvalue>
</initparam>
<initparam>
<paramname>scope</paramname>
<paramvalue>session</paramvalue>
</initparam>
</filter>
<filtermapping>
<filtername>encodingFilter</filtername>
<urlpattern>*do</urlpattern>
</filtermapping>
<filtermapping>
<filtername>encodingFilter</filtername>
<urlpattern>*jsp</urlpattern>
</filtermapping>
<filtermapping>
<filtername>cacheFilter</filtername>
<urlpattern>*do</urlpattern>
</filtermapping>
其中特別要注意encode的filter要放在cache filter前面這樣就不會有亂碼問題
拷貝oscacheproperties到classpath下面
From:http://tw.wingwit.com/Article/program/Java/hx/201311/27099.html