警告:动作与允许的动作名称模式不匹配,清理它
Warning: Action does not match allowed action names pattern, cleaning it up
我有以下struts.xml
:
<action name="viewreports" class="com.mypackage.action.ViewReportsAction">
<interceptor-ref name="notauth" />
<interceptor-ref name="defaultStack" />
<result>/staff-view-reports.jsp</result>
<result name="index" type="redirect">/index.jsp</result>
</action>
<action name="viewdepartment" class="com.mypackage.action.ViewDepartmentAction">
<interceptor-ref name="notauth" />
<interceptor-ref name="defaultStack" />
<result>/staff-view-department.jsp</result>
<result name="input" type="redirectAction">viewreports</result>
<result name="index" type="redirect">/index.jsp</result>
</action>
它做了它应该做的事情,但这个警告出现在控制台中:
WARNING: Action ["viewdepartment"] does not match allowed action names pattern [[a-zA-Z0-9._!/\-]*], cleaning it up!
我的动作名真的有问题吗?
该模式不允许在操作名称中使用双引号。动作名称和命名空间由动作映射器通过解析请求的 URI 确定。此时映射器试图将动作映射设置为适当的动作名称和名称空间,并可能默认为 ""
。并且它在清理时使用上面的模式来匹配动作名称。您的操作名称与该模式不匹配,因此您会收到警告。 xml 配置看起来不错。
我有以下struts.xml
:
<action name="viewreports" class="com.mypackage.action.ViewReportsAction">
<interceptor-ref name="notauth" />
<interceptor-ref name="defaultStack" />
<result>/staff-view-reports.jsp</result>
<result name="index" type="redirect">/index.jsp</result>
</action>
<action name="viewdepartment" class="com.mypackage.action.ViewDepartmentAction">
<interceptor-ref name="notauth" />
<interceptor-ref name="defaultStack" />
<result>/staff-view-department.jsp</result>
<result name="input" type="redirectAction">viewreports</result>
<result name="index" type="redirect">/index.jsp</result>
</action>
它做了它应该做的事情,但这个警告出现在控制台中:
WARNING: Action ["viewdepartment"] does not match allowed action names pattern [[a-zA-Z0-9._!/\-]*], cleaning it up!
我的动作名真的有问题吗?
该模式不允许在操作名称中使用双引号。动作名称和命名空间由动作映射器通过解析请求的 URI 确定。此时映射器试图将动作映射设置为适当的动作名称和名称空间,并可能默认为 ""
。并且它在清理时使用上面的模式来匹配动作名称。您的操作名称与该模式不匹配,因此您会收到警告。 xml 配置看起来不错。