struts2 default action is set but not visit

1, the cause of the error

  There are two of my package in action, the first is the default action, for error handling action when there is no access, and the second is a wildcard way to write action, name using the form * _ * Full wildcard. Configured, the default action when access will complain, but if the package name of the class attribute of the second action also contain wildcards, such as code after the adjustment of {3}, you can normally access the default action, do not know why estimated to be bug.

2, struts.xml error when the package is part of the code

< Struts > 
    < Package Penalty for name = "default" namespace = "/" the extends = "Struts-default" strict-Invocation-Method, = "false" > 
        ! <- default action: the action when the user wants to access the incorrect when automatically jump to the page -> 
        < default-Action-REF name = "index"  /> 
        < Action name = "index" > 
            < Result > /error.jsp </ Result > 
        </ Action > 

        < Action name = "* _ *" method="{2}" class="com.icheny.action.{1}Action">
            <result>/result.jsp</result>
            <result name="add">/{2}.jsp</result>
            <result name="update">/{2}.jsp</result>
        </action>
    </package>
</struts>

3, the second class package name in the action part of the code increase struts.xmlpackage after a wildcard

< Package Penalty for name = "default" namespace = "/" the extends = "Struts-default" strict-Invocation-Method, = "false" > 
        ! <- default action: the action when the user wants to access an incorrect automatic jump go to the page -> 
        < default-Action-REF name = "index"  /> 
        < Action name = "index" > 
            < Result > /error.jsp </ Result > 
        </ Action > 
       
        < Action name = "* _ * _ * " Method =" {2} " class="com.icheny.{3}.{1}Action">
            <result>/result.jsp</result>
            <result name="add">/{2}.jsp</result>
            <result name="update">/{2}.jsp</result>
        </action>
    </package>

 

Guess you like

Origin www.cnblogs.com/iCheny/p/10964282.html