I haven't written struts2 for a long time. Today, the following bug occurs:
Warning cocould not find action or resultthere is no Action mapped for namespace/and action name users. -[unknown location] at com. opensymphony. xwork2.defaactionactionproxy. prepare (defaactionactionproxy. java: 189) at Org. apache. struts2.impl. strutsactionproxy. prepare (strutsactionproxy. java: 61) at Org. apache. struts2.impl. strutsactionproxyfactory. createactionproxy (strutsactionproxyfactory. java: 39) at com. opensymphony. xwork2.defaactionactionproxyfactory. createactionproxy (defaactionactionproxyfactory. java: 58) at Org. apache. struts2.dispatcher. dispatcher. serviceaction (dispatcher. java: 475) at org.apache.struts2.dispatcher.ng.executeoperations.exe cuteaction (executeoperations. java: 77) at Org. apache. struts2.dispatcher. ng. filter. strutsprepareandexecutefilter. dofilter (strutsprepareandexecutefilter. java: 91) at Org. apache. catalina. core. applicationfilterchain. internaldofilter (applicationfilterchain. java: 243) at Org. apache. catalina. core. applicationfilterchain. dofilter (applicationfilterchain. java: 210) at Org. apache. catalina. core. standardwrappervalve. invoke (standardwrappervalve. java: 224) at Org. apache. catalina. core. standardcontextvalve. invoke (standardcontextvalve. java: 169) at Org. apache. catalina. authenticator. authenticatorbase. invoke (authenticatorbase. java: 472) at Org. apache. catalina. core. standardhostvalve. invoke (standardhostvalve. java: 168) at Org. apache. catalina. valves. errorreportvalve. invoke (errorreportvalve. java: 100) at Org. apache. catalina. valves. accesslogvalve. invoke (accesslogvalve. java: 929) at Org. apache. catalina. core. standardenginevalve. invoke (standardenginevalve. java: 118) at Org. apache. catalina. connector. coyoteadapter. service (coyoteadapter. java: 405) at Org. apache. coyote. http11.20.acthttp11processor. process (abstracthttp11processor. java: 964) at Org. apache. coyote. abstractprotocol $ abstractconnectionhandler. process (abstractprotocol. java: 515) at org.apache.tomcat.util.net. aprendpoint $ socketprocessor. run (aprendpoint. java: 1824) at java. util. concurrent. threadpoolexecutor $ worker. runtask (threadpoolexecutor. java: 886) at java. util. concurrent. threadpoolexecutor $ worker. run (threadpoolexecutor. java: 908) at java. lang. thread. run (thread. java: 619)
The configuration file is as follows:
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"><struts> <package name="user_test" extends="json-default" namespace="/"> <action name="/users" class="cn.csdn.struts.web.action.UserAction" method="listUsers"> <result name="error">/error.jsp</result> <result name="success">/users.jsp</result> </action> </package> </struts>
When the error occurs, Action = "/users" appears here. Remove "/" and it will be OK.