在網上google半天也沒見人解決,還是看了FilterDispatcher的源碼才解決,特地貼到blog上,備忘吧。
在com.opensymphony.webwork.dispatcher.FilterDispatcher中有以下代碼
1?????????????if?("true".equals(Configuration.get(WebWorkConstants.WEBWORK_SERVE_STATIC_CONTENT))?
2?????????????????????&&?resourcePath.startsWith("/webwork"))?{
3?????????????????String?name?=?resourcePath.substring("/webwork".length());
4?????????????????findStaticResource(name,?response);
5?????????????}?else?{
6?????????????????//?this?is?a?normal?request,?let?it?pass?through
7?????????????????chain.doFilter(request,?response);
8?????????????}
也就是說,只要webwork.properties文件中webwork.serve.static=true(系統默認),并且FilterDispatcher這個過濾器對/webwork/*這個url進行了處理的話,就不會發生使用ww2提供的
datepicker時,找不到/webwork/*下所有的js、image等資源,不得不手工拷貝webwork.jar中/com/opensymphony/webwork/static為/webwork/*的情況。
?1?????<filter>
?2?????????<filter-name>webwork</filter-name>
?3?????????<filter-class>com.opensymphony.webwork.dispatcher.FilterDispatcher</filter-class>
?4?????</filter>
?5?????<filter-mapping>
?6?????????<filter-name>webwork</filter-name>
?7?????????<url-pattern>*.action</url-pattern>
?8?????</filter-mapping>
?9?????<filter-mapping>
10?????????<filter-name>webwork</filter-name>
11?????????<url-pattern>/webwork/*</url-pattern>
12?????</filter-mapping>