Tomcat报错:No result type specified for result named 'success'

今天学Struts,

tomcat报出了异常信息 Exception starting filter [struts2] Unable to load configuration.还有 No result type specified for result named ‘success’,

找了很久终于在stackoverflow上找到了报错原因,在struts.xml的配置文件中需要加上 namespace=”/”;

这样就不会报错了

<package name="p1" namespace="/" extends="struts-default">
        <action 
        name="hello" class="com.gyf.web.action.HelloAction" method="sayHello">
        <result name="success">/success.jsp</result>
        </action>
        
   </package>

分享上stackoverflow的源答案

点赞