Error there is no Action mapped for namespace/and action name-struts2

Source: Internet
Author: User

Struts2 An error has occurred, always prompt "There is no action mapped for Namespace/and action name" error.

The error code is as follows:

09:36:13,515WARN [Dispatcher] Could not find action or resultthere is no action mapped fornamespace [/] and action name [CSS] associated with context path [/chinaunicom]. -[Unknown Location] at Com.opensymphony.xwork2.DefaultActionProxy.prepare (Defaultactionproxy.java:185) at Org.apache.struts2.impl.StrutsActionProxy.prepare (Strutsactionproxy.java:63) at Org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy (Strutsactionproxyfactory.java:39) at Com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy (Defaultactionproxyfactory.java: 58) at Org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java:534) at Org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction (Executeoperations.java:77) at Org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter ( Strutsprepareandexecutefilter.java:91) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:235) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:206) at Org.apache.catalina.core.StandardWrapperValve.invoke (Standardwrappervalve.java:233) at Org.apache.catalina.core.StandardContextValve.invoke (Standardcontextvalve.java:191) at Org.apache.catalina.core.StandardHostValve.invoke (Standardhostvalve.java:127) at Org.apache.catalina.valves.ErrorReportValve.invoke (Errorreportvalve.java:102) at Org.apache.catalina.core.StandardEngineValve.invoke (Standardenginevalve.java:109) at Org.apache.catalina.connector.CoyoteAdapter.service (Coyoteadapter.java:293) at Org.apache.coyote.http11.Http11Processor.process (Http11processor.java:859) at Org.apache.coyote.http11.http11protocol$http11connectionhandler.process (Http11protocol.java:602) at Org.apache.tomcat.util.net.jioendpoint$worker.run (Jioendpoint.java:489) at Java.lang.Thread.run (Thread.java:619)

Internet query found that this is a beginner frequently encountered problems, leading to the reasons for the main two kinds of errors. Summarized as follows:

1.struts.xml file error. This error is divided into the following categories:

1.1struts.xml file name error. Be sure to pay attention to spelling problems;

1.2struts.xml file placement path error. Be sure to place this file in the SRC directory. After the compilation is successful, verify that it is compiled into the classes directory;

1.3struts.xml file content error. A correct struts.xml file is given below for reference. Note 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.or G/dtds/struts-2.0.dtd "><Struts>    < Packagename= "Default"namespace="/"extends= "Struts-default">        <Actionname= "Login"class= "Com.wanggc.struts2.sample.Struts2Action">        <resultname= "Success">/jsp/result.jsp</result>        </Action>    </ Package></Struts>

2. If you exclude the problem with the Struts.xml file, another possibility is that you have configured your project's startup page in the <welcome-file> information in the Web. xml file. If there is no configuration, the address bar to enter the completion of the URL, such as: http://localhost:8080/Struts2Sample/jsp/login.jsp, the following resource details are not entered when the error will be reported, I was planted on this issue (^_ ^).

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.