问题标签 [struts2-convention-plugin]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
struts2 - 启动错误:java.lang.IncompatibleClassChangeError:org/apache/struts2/convention/DefaultClassFinder$InfoBuildingVisitor
我有一个 Struts2 应用程序,最初是基于 XML 的,但现在我第一次引入了基于 Annotation 的操作,并且该应用程序在启动时中断。
鉴于以下动作映射,在应用程序启动时,我收到错误
这里有一个类似的问题,但没有人回答, Struts2 Filter Exception问题
使用的库:
- struts2-convention-plugin-2.3.14.3.jar
- struts2-core-2.5.10.1.jar
- struts2-json-plugin-2.5.10.1.jar
- struts2-spring-plugin-2.5.10.1.jar
- struts2-tiles-plugin-2.5.10.1.jar
- xwork-core-2.1.6.jar
更新:我认为 Convention-Plugin-JAR 2.3.14.3 与其他 2.5.10.1 不兼容,所以我下载了:struts2-convention-plugin-2.5.10.1.jar
现在在启动时
解决方案 解决方案是添加 ASM 5.x JAR,它是 Struts-Convention JAR 注释的依赖项。我们使用的是 ASM 3.3。我添加了 ASM-Core、-Common、-Tree 5.1 版 JAR。
struts2 - Struts2 Conventions Plugin 中的 default-action-ref 是否有等效项
我想要一个动作默认值,但不是在 XML 中,因为我想通过 Struts2 Conventions Plugin 使用注释。
所以我想更换
在注释中有一些东西,所以我不必使用 struts.xml 文件,而且在 URL 中指定未知操作时也重定向到特定操作。
Struts2 Convention Plugin 是否对此提供支持,或者是否有任何基于注释的好的解决方法?
java - @Result Annotation 中的 Param 属性使用
如何在@Result Annotation 中指定要转换为 JSON 的变量?
现在它将所有带有 getter 的变量转换为 JSON 字符串。
如何在@Result 中使用 params 属性?
java - Struts 2 约定插件不起作用!如何让它运行?
我尝试使用官方文档上的教程使用 Struts 2 约定插件,但我无法让它运行。
这是我的配置方式:
pom.xml
web.xml
我按照教程创建了以下文件hello-world.jsp
,
HelloWorld.java
它们是动作类。
HelloWorld.java
你好世界.jsp
根据文档,
首先,Convention 插件查找名为 struts、struts2、action 或 actions 的包。任何与这些名称匹配的包都被视为 Convention 插件的根包。接下来,插件查看这些包以及子包中的所有类,并确定这些类是否实现了 com.opensymphony.xwork2.Action 或者它们的名称是否以 Action 结尾(即 FooAction)。
我的设置看起来像这样
项目设置
运行tomcat时出现以下错误:
我的页面没有加载。我收到 HTTP 状态 404 错误。
我怎样才能解决这个问题?
java - Struts2 Convention Plugin @Actions not mapping with Spring Boot
When upgrading my application to use Spring Boot version 2.1.8.RELEASE + struts2-convention-plugin with Struts2-core version 2.5.20 the actions are not being mapped correctly and I am getting the error
com.opensymphony.xwork2.config.ConfigurationException: There is no Action mapped for namespace [/] and action name [home] associated with context path [].
If I decalre the actions in struts.xml
they work perfectly.
Below is my current configuration, why are they not mapping?
I have tried many diffrent configs and nothing seems to work, the StrutsPrepareAndExecuteFilter
is firing but not actions are found, as if Spring has not scanned them. Could this be a dependency version issue?
application.yaml
Struts2.xml
Controller
Main
Struts2 Filter
UPDATE
java - 当 Struts2 位于 war 文件中的 jar 文件中并且 Struts2 被部署为 Wildfly 模块时,它们无法找到我的操作
我正在使用 Wildfly 并将 Struts2 部署为模块。我将我的 project.war 文件部署到独立/部署中。project.war/WEB-INF/lib 中有一个 project-web.jar 文件,其中包含我的 Struts2 操作。我正在使用约定插件。在我的 struts2.xml 我有以下内容:
我得到的错误包括
虽然 Wildfly 中没有 bin\content 文件夹,但我发现它与 JBoss vfs 有关。
请注意,当我使用 project.war 而不是作为模块部署 Struts2 时,webapp 可以正常工作。
为什么 Struts2 找不到我的动作?
java - 在服务器启动时获取 java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener - Struts 2.3.28 & Tile-core-2.2.2
我们正在将 struts 1.2.9 迁移到 strtus 2.3.28。在此过程中,我在 WEB.xml 中添加了StrutsTilesListener。尝试使用 struts 2.3.28 和 tiles-api-2.2.2 启动 Wildfly 10.1 服务器时出现以下异常。
解决此问题的任何解决方案都会有所帮助。
lib 文件夹中的罐子:
struts2-convention-plugin-2.3.28.jar
struts2-tiles-plugin-2.3.28.jar
struts2-core-2.3.28.jar
tiles-api-2.2.2.jar
tiles-core-2.2 .2.jar
tiles-request-api-1.0.1.jar
tiles-request-servlet-1.0.1.jar
tiles-servlet-2.2.2.jar
tiles-template-2.2.2.jar
WEB.xml
控制台错误:
annotations - Struts 2 post back 默认
在 Struts 文档中,它说:
另一个常见的工作流策略是首先使用替代方法呈现页面,例如输入,然后将其提交回默认的执行方法。
https://struts.apache.org/core-developers/action-configuration.html#post-back-default
如何仅使用注释来做到这一点?似乎只execute()
调用了方法。