-->

Struts 2 action not working if the action name=“ap

2019-09-19 08:48发布

问题:

Problem so simple, if the action name is "apply" this action doesn't work at all, and it gave the

HTTP Status 404 - No result defined for action com.control.actions.ClassName and result success

example of the struts.xml:

<action name="apply" method="display"
    class="com.control.actions.ClassName">
    <result name="none">/page.jsp</result>
</action>

but it works if the action name is anything else like:

<action name="applying" method="display"
    class="com.control.actions.ClassName">
    <result name="none">/page.jsp</result>
</action>

So is apply a kind of Struts2 key word?

回答1:

No, apply isn't a keyword.

None of these configurations apply to the action being executed.

The error message tells that no result is created for the action but there's a result code and result code is not "none".

In most cases this means that no result is configured for the action. If you are using convention or rest plugins there may be implicit configs created using conventions.

Use the config-browser plugin to see the configuration provided to your application or debug to troubleshoot it.