熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

oscache的頁面緩存

2022-06-13   來源: Java核心技術 

  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
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.