Summary of "there is no action mapped for namespace/and action name" in struts2

Source: Internet
Author: User

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_^ ).

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.