Today, when using Struts2, the running always prompts There is no Action mapped for namespace/and action name.
According to the prompt, it can be determined that such action does not exist in the namespace.
However, the configuration is correct after careful check.
After judging Struts. xml and web. xml one by one, the content of web. xml is as follows:
[Html]
<? Xml version = "1.0" encoding = "UTF-8"?> Www.2cto.com
<Web-app xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xmlns = "http://java.sun.com/xml/ns/javaee" xmlns: web = "http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
Xsi: schemaLocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
Id = "WebApp_ID" version = "2.5">
<Display-name> 8.1 </display-name>
<Welcome-file-list>
<Welcome-file> index.html </welcome-file>
<Welcome-file> index.htm </welcome-file>
<Welcome-file> index. jsp </welcome-file>
<Welcome-file> default.html </welcome-file>
<Welcome-file> default.htm </welcome-file>
<Welcome-file> default. jsp </welcome-file>
</Welcome-file-list>
<Filter>
<Filter-name> struts2 </filter-name>
<Filter-class> org. apache. struts2.dispatcher. ng. filter. StrutsPrepareAndExecuteFilter </filter-class>
</Filter>
<Filter-mapping>
<Filter-name> struts2 </filter-name>
<Url-pattern>/* </url-pattern>
</Filter-mapping>
</Web-app>
In the project, there is no page defined by these elements under welcom-file-list. Therefore, after running the project in Eclipse directly, the page cannot be found and an error is prompted.
After being modified to the corresponding welcom-file, the operation is correct.