java - 升级到 2.5.26 后,Struts 通配符映射不起作用
问题描述
我有一个使用通配符映射的操作类。它在 struts 2.5.22 中工作,但我尝试升级到 2.5.26(和 2.5.25),现在永远不会调用 setType。
@Component
@Namespace("/applications/proxy")
@Flow(purgeAllBefore = "Y")
@Action(value = "{type}")
@Results({@Result(name = "input", type = "dispatcher", location = "/jsp/applications/proxy.jsp"),
@Result(name = "success", type = "redirectAction", location = "${type}", params = {"namespace", "/applications"}),
@Result(name = "auto-select", type = "redirectAction", location = "${autoSelectUrl}", params = {"namespace", "/"})})
public class ProxyAction extends SearchSupport {
// Struts wildcard action mapping variable for the attachment, for example: 'J', 'R', 'I', 'N', 'H'
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
...
解决方案
好的,我发现了问题。strutsconfig 文件中需要此行,但文档中不需要:
<constant name="struts.matcher.appendNamedParameters" value="true"/>
推荐阅读
- flutter - getter 中的 switch 语句
- javascript - 在 nextjs 中使用 JavaScript 的 Jquery
- angular - 当它们在 spectator.component 之外时如何模拟 / spyOn 常量
- react-native - React Native Google API 没有响应
- java - Java 服务内存使用量增加
- android - Flutter Android TV 应用程序被拒绝,因为“启动后崩溃”,但它在模拟器和 android 电视上正常工作。你有什么建议吗?
- p5.js - p5.js 的 PoseNet 函数
- c++ - 与 MakeFile 等效的 cmake
- javascript - 如何在 React 和 JSX 中导入名称中包含特殊字符的 JS 文件?
- ios - SwiftUI:如何在后台应用程序时添加带有应用程序徽标的模糊视图?