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 网络科学导论,网络控制
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)