ueu2715
2013-08-12 11:22 阅读 342
已采纳

struts2兼容struts1问题,求大神

struts2-struts1-plugin
官方文档
[url]http://struts.apache.org/release/2.3.x/docs/struts-1-plugin.html[/url]
在struts2环境下配置最简单的struts1 action

In the most simple case, where you have a Struts 1 Action that you want to use in Struts 2, configure a Struts 2 action using the wrapper:
[code="java"]

com.mycompany.myapp.MyAction
myAction.jsp

[/code]
访问的时候报错:
[code="java"]
严重: Exception occurred during processing request: null
java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
[/code]

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • 已采纳
    jinandmei jinbingchuan 2013-08-12 11:36

    看了文档,感觉需要注意的应该有
    1 To use existing Struts 1 Actions and ActionForms in a Struts 2 application, create a normal Struts 2 configuration package in struts.xml, but have it extend struts1-default. The struts1-default package contains several interceptors and a default interceptor stack that work the plugin into the Struts 2 request process.
    这里说需要继承struts1-default

    2 This plugin can be installed by copying the plugin jar into your application's /WEB-INF/lib directory. It will need the Struts 1 jar in order to function correctl
    相关的 插件jar和strus1相关的jar拷贝到/WEB-INF/lib目录下面

    点赞 评论 复制链接分享
  • chenxiang105 chenxiang105 2013-08-12 11:31

    是不是表单数据有问题.processing request: null

    点赞 评论 复制链接分享
  • zyn010101 zyn010101 2013-08-12 13:16

    异常只有这么一点么?

    点赞 评论 复制链接分享
  • angelbill3 angelbill3 2013-08-12 13:48

    可以参考下我的博文。
    [url]http://angelbill3.iteye.com/blog/1892411[/url]

    点赞 评论 复制链接分享

相关推荐