关于找不到类org.apache.struts2.sitemesh.FreemarkerPageFilter java.lang.ClassNotFoundException: org.apache.

关于找不到类org.apache.struts2.sitemesh.FreemarkerPageFilter

java.lang.ClassNotFoundException: org.apache.struts2.sitemesh.FreemarkerPageFilter

 

原因:struts-sitemesh-plugin 2.1.8中FreeMarkerPageFilter的失效问题

 

解决方法:

 

方法1:升级struts2的版本

 

Struts 2.2.1修复了之前版本的众多bug,主要修复列举如下:

 

<s:reset type="image">标签上缺少src属性

Struts2 showcase无法在JBoss 5.1上部署

struts-sitemesh-plugin 2.1.8中FreeMarkerPageFilter的失效问题

XWork FileManager不会解码URL

ConventionUnknownHandler与rest插件的协作问题

StrutsSpringTestCase的内存泄漏问题

css_xhtml主题无法应用在IE8上,在其他浏览器上也无法正常使用

javassist在JBoss 5.1上的问题

 

Struts 2.2.1的主要改进列举如下:

 

升级至OGNL 2.7

文件上传:可以对allowedTypes参数设置不同的File Content Type值

完全集成了SiteMesh 2、Freemarker 2.4.2及Velocity 1.3

将xwork核心迁移至Struts 2

将FreeMarker升级至2.3.16

将Velocity引擎升级至1.6.3

 

方法2:修改原代码

 

Struts2的sitemesh插件struts2-sitemesh-plugin-2.1.6的一个BUG,是FreeMarkerPageFilter的getLocale方法没有对invocation添加非空判断造成的,解决办法是解压包,然后找到org.apache.struts2.sitemesh.FreeMarkerPageFilter这个类,将

view plain

1.      protected Locale getLocale(ActionInvocation invocation, Configuration configuration) {      

2.              if (invocation.getAction() instanceof LocaleProvider) {      

3.                  return ((LocaleProvider) invocation.getAction()).getLocale();      

4.              } else {      

5.                  return configuration.getLocale();      

6.              }      

7.      }     

 修改为:

view plain

1.      protected Locale getLocale(ActionInvocation invocation, Configuration configuration) {      

2.          if (invocation != null && invocation.getAction() instanceof LocaleProvider) {      

3.              return ((LocaleProvider) invocation.getAction()).getLocale();      

4.          } else {      

5.              return configuration.getLocale();      

6.          }      

7.      }      

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值