我目前的项目结构如下
WebContent
WEB-INF
View
TestPage.jsp
other JSP pages...
我的任务是将所有 JSP 页面放在文件夹 WEB-INF 中,并在项目中进行所有相关更改。
WebContent
WEB-INF
View
TestPage.jsp
other JSP pages...
所以我必须更新 struts.xml 中的所有结果标签
<result name="success">/View/TestPage.jsp</result>
到
<result name="success">/WEB_INF/View/TestPage.jsp</result>
在网上搜索后,我找到了一个插件 - struts 约定插件来实现这一点,但它遵循其命名约定。
我可以覆盖 Struts 约定插件配置(不遵循其命名约定)吗?我也尝试过,但它没有反映。我struts.xml
的是
<struts>
<constant name="struts.devMoade" value="true" />
<constant name="struts.convention.result.path" value="/WEB-INF/View/" />
<package name="test" extends="struts-default" namespace="/">
<action name="hello1" class="testAction.Hello1Action">
<result name="success">/TestPage.jsp</result>
</action>
</package>
</struts>
当我跑
localhost:8080/project-name/hello1
它显示错误 404。但是如果我将 struts.xml 中的结果更改为
<result name="success">/WEB-INF/View/TestPage.jsp</result>
它工作正常。
我不想对所有结果标签进行更改。如何通过在一个地方进行更改来实现这一点?