There is no Action mapped for namespace [/] and action name [m_hi] associated with context path [](代

Posted 橙木鱼

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了There is no Action mapped for namespace [/] and action name [m_hi] associated with context path [](代相关的知识,希望对你有一定的参考价值。

最近更新struts版本发现,无论怎么访问就是无法映射到指定的配置文件,最后发现原来是访问控制的原因.
struts2.3之后为了访问安全,增加了请求方法拦截,这样会造成使用通配符访问时无法找到映射对象的错误提示:
There is no Action mapped for namespace [/] and action name [m_hi] associated with context path [].
 
解决方式:
    1 如果你的引用包struts2-core是2.3以上版本需要更新struts.xml的文件头:    
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
        "http://struts.apache.org/dtds/struts-2.5.dtd">

   2 并在struts.xml中开放方法访问:
  方式一:全局配置

    <package name="default" extends="struts-default">
      <global-allowed-methods>regex:.*</global-allowed-methods>
    </package>

        方式二:action标签内配置(多个方法逗号隔开)    

    <action name="login" method="login" class="loginAction">
      <result name="login">/WEB-INF/login.jsp</result>
      <allowed-methods>login</allowed-methods>
    </action>

 

 






以上是关于There is no Action mapped for namespace [/] and action name [m_hi] associated with context path [](代的主要内容,如果未能解决你的问题,请参考以下文章

Struts2-tomcat报错:There is no Action mapped for namespace / and action

There is no Action mapped for namespace [/] and action name [Login] associated

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [product-save] associa

Struts2中There is no Action mapped for namespace错误解决方法

Struts2中There is no Action mapped for namespace错误解决方法

There is no Action mapped for namespace / and action name 通配符的问题