ueu2715 2013-08-12 11:22
浏览 350
已采纳

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条回答

  • 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目录下面

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘