Org.apache.struts.chain.commands.InvalidPathException:No Action Config found for the specified URL.

Source: Internet
Author: User

No Action Config found for the specified URL

The action was not found under the URL path because of a stuts-config.xml file configuration error.

The project file for the demo is as follows:

Invoke the action using the login.jsp file in the JSP folder:

<%@ Page Language="Java"ContentType="text/html"pageencoding="GBK"%><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head><title>User Login</title></Head><Body>    <!--Standard Login Box -    <DivID= "Login_loginform">        <Div>Account Login</Div>        <formMethod= "POST"Action= "Loginng.do">Account Number:<inputname= "username"type= "text">Password:<inputname= "Password"type= "Password">                <aTarget= "_blank"href= "register.jsp">Free Registration</a>                <inputtype= "Submit"value= "Login">                <inputtype= "Reset"value= "Re-enter">        </form>    </Div></Body></HTML>

The Web. XML configuration file is as follows:

<?XML version= "1.0" encoding= "UTF-8"?><Web-appXmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xmlns= "Http://xmlns.jcp.org/xml/ns/javaee"xsi:schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"ID= "webapp_id"version= "3.1">  <Display-name>Strutssample</Display-name>    <servlet>      <Servlet-name>Action</Servlet-name>      <Servlet-class>Org.apache.struts.action.ActionServlet</Servlet-class>      <Init-param>          <Param-name>Config</Param-name>          <Param-value>/web-inf/struts-config.xml</Param-value>      </Init-param>      <Load-on-startup>1</Load-on-startup>  </servlet>  <servlet-mapping>      <Servlet-name>Action</Servlet-name>      <Url-pattern>*.do</Url-pattern>  </servlet-mapping>    <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>  </Web-app>

The Struts-config.xml configuration file is as follows:

<?XML version= "1.0" encoding= "UTF-8"?><!DOCTYPE struts-config Public "-//apache software foundation//dtd struts Configuration 1.3//en" "http ://struts.apache.org/dtds/struts-config_1_3.dtd "><Struts-config>    <Form-beans>        <Form-beanname= "LoginForm"type= "Org.sunnywen.struts.LoginActionForm">        </Form-bean>    </Form-beans>    <action-mappings>        <ActionPath= "/loginng"name= "LoginForm"type= "Org.sunnywen.struts.LoginAction">            <forwardname= "Loginsuccess"Path= "/index.jsp"></forward>        </Action>    </action-mappings></Struts-config>

Loginactionform is a class that inherits Actionform, Loginaction is the class that inherits the action, and the error occurs when you run: Org.apache.struts.chain.commands.InvalidPathException:No Action Config found for the specified URL.

The reason is that the JSP file is in the JSP folder,action= "loginng.do" will automatically look for the same folder (that is, the JSP folder) Loginng.do, and in the path to the action configured in Struts-config.xml is configured under the root directory, so it should be configured as follows:

<action-mappings>        <ActionPath= "/jsp/loginng"name= "LoginForm"type= "Org.sunnywen.struts.LoginAction">            <forwardname= "Loginsuccess"Path= "/index.jsp"></forward>        </Action>    </action-mappings>

Reprint please specify reprint address: http://www.cnblogs.com/FlyingPuPu/p/5129631.html

Org.apache.struts.chain.commands.InvalidPathException:No Action Config found for the specified URL.

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.