Debugging a basic struts2 framework today is smallProgram. The error "there is no action mapped for namespace/and action name" is always prompted. After querying the Internet, I found that this is a problem that beginners often encounter. There are two main causes of errors. Summary:
1. the Struts. xml file is incorrect. This error can be divided into the following types: 1. The file name of Struts. XML is incorrect. Be sure to pay attention to spelling issues; 2. the Struts. xml file placement path is incorrect. Be sure to place the file in the src directory. After the compilation is successful, check whether the file is compiled into the classes directory. 3. The content of the Struts. xml file is incorrect. The following provides a correct struts. xml file for your reference. Pay attention to the background color section.
<? XML version = "1.0" encoding = "UTF-8" ?>
<!Doctype struts public
"-// Apache Software Foundation // DTD struts configuration 2.0 // en"
Http://struts.apache.org/dtds/struts-2.0.dtd">
< Struts >
< Package Name = "Default" Namespace = "/" Extends ="Struts-Default" >
< Action Name = "Login" Class = "Com. wanggc. struts2.sample. struts2action" >
< Result Name = "Success" > /JSP/result. jsp </ Result >
</ Action >
</ Package >
</ Struts >
2. If the Struts. xml file is excluded, whether the startup page of your project is configured in the <welcome-File> information in the web. xml file. If no configuration is available, enter the completed URL in the address bar, for example, http: // localhost: 8080/struts2sample/JSP/login. JSP, this error will also be reported when the following resource details are not entered. I am planted on this issue (pai_^ ).