struts.convention.result.path在Struts2中不起作用
我目前的项目结构如下
WebContent WEB-INF View TestPage.jsp other JSP pages...
我的任务是将所有JSP页面放在WEB-INF文件夹中,并在项目中进行所有相关更改。
WebContent WEB-INF View TestPage.jsp other JSP pages...
所以我必须更新struts.xml中的所有结果标记
/View/TestPage.jsp
至
/WEB_INF/View/TestPage.jsp
在网上搜索之后,我找到了一个插件 – struts convention插件来实现这一点,但它遵循它的命名约定。
我可以覆盖Struts约定插件配置(不遵循其命名约定)吗?我也尝试过,但它没有反映。 我的struts.xml
是
/TestPage.jsp
当我跑
localhost:8080/project-name/hello1
它显示错误404.但是如果我在struts.xml中更改结果为
/WEB-INF/View/TestPage.jsp
它工作正常。
我不想对所有结果标签进行更改。如何通过在一个地方进行更改来实现此目的?
约定插件使用不同的配置提供程序,此常量仅适用于按约定创建的配置。
如果要覆盖约定配置,则应使用注释。
package testAction; @ParentPackage("json-default") @Namespace("/") @Action(value="hello1", results=@Result(name = "success", location="TestPage.jsp")) public class Hello1Action extends ActionSupport { }