WebWork学习小记

WebWork学习小记

1、集成各种view
推荐直接使用 result type 集成
2、在集成freemarker时候需要注意:
  1) <#assign ww=JspTaglibs["/WEB-INF/lib/webwork.tld"] />已不用因为 webwork2.2的freemarker的tag支持是内置的,
  2)${wwUtil}已换成${webwork}
3、使用sitemesh时,一般推荐使用其PageFilter得扩展。
  1)Velocity:VelocityPageFilter
  2)Freemarker:
FreeMarkerPageFilter
  3) ActionContextCleanUp的作用是告诉会通知FilterDispatcher在正确的时间清除请求.否则,ActionContext将在SiteMesh修饰器访问数据之前被清除.
  ∴ 使用的时候web.xml加声明(顺序很重要)
< filter >
< filter-name > webwork-cleanup </ filter-name >
< filter-class >
   com.opensymphony.webwork.dispatcher.ActionContextCleanUp
</ filter-class >
</ filter >
< filter >
< filter-name > sitemesh </ filter-name >
<!--  此处的XXX为Velocity或FreeMarker,根据实际而定  -->
< filter-class > com.opensymphony.webwork.sitemesh.XXXPageFilter </ filter-class >
</ filter >
< filter >
< filter-name > webwork </ filter-name >
< filter-class > com.opensymphony.webwork.dispatcher.FilterDispatcher </ filter-class >
</ filter >

< filter-mapping >
< filter-name > webwork-cleanup </ filter-name >
< url-pattern > /* </ url-pattern >
</ filter-mapping >
< filter-mapping >
< filter-name > sitemesh </ filter-name >
< url-pattern > /* </ url-pattern >
</ filter-mapping >
< filter-mapping >
< filter-name > webwork </ filter-name >
< url-pattern > /* </ url-pattern >
</ filter-mapping >

你可能感兴趣的:(WebWork学习小记)