页面错误信息如下:
********************************************************************************************
javax.servlet.ServletException: org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
tsrj.hxjk.pub.filter.SetCharterFilter.doFilter(SetCharterFilter.java:20)
root cause org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
org.apache.struts.chain.commands.AbstractSelectAction.execute(AbstractSelectAction.java:71)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
tsrj.hxjk.pub.filter.SetCharterFilter.doFilter(SetCharterFilter.java:20)******************************************************************************

解决方案 »

  1.   

    actionbeans.xml文件配置如下
    ********************************************************************************
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    <beans>
    <bean name="/test" class="tsrj.hxjk.test.cmd.TestAction">
    <property name="service">
    <ref bean="test.TestService"/>
    </property>
    </bean>
    <bean id="test.TestService" class="tsrj.hxjk.test.service.impl.TestServiceImpl">
    <property name="dao">
    <ref local="test.TestDao"/>
    </property>
    </bean>
    <bean id="test.TestDao" class="tsrj.hxjk.test.dao.jdbc.TestDaoJdbc">
    <property name="dataSource" ref="dataSource"></property>
    </bean>
    </beans>
    ******************************************************
      

  2.   

    struts-config.xml
    ********************************************************
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
      <data-sources />
      <form-beans />
      <global-exceptions />
      <global-forwards />
      <action-mappings>
    <action  path="/test" type="org.springframework.web.struts.DelegatingActionProxy" parameter="cmd">
       <forward name="success" path="/test/main.jsp"></forward>
    </action>
      </action-mappings>
     
      <message-resources parameter="com.yourcompany.struts.ApplicationResources" />
       <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
    <set-property property="contextConfigLocation" value="/WEB-INF/actionbeans.xml" />
    </plug-in>
    </struts-config>
    ******************************************************************************
      

  3.   

    web.xml
    *******************************************************************************
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     version="2.4" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee  
      http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <!-- 定义系统根目录 -->

    <context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>hxjk120.root</param-value>
    </context-param>

    <!-- 配置加载文件 -->

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>WEB-INF/conf/base/plat-servlet.xml,WEB-INF/conf/base/jdbcDataSource.xml

    </param-value>
    </context-param>

    <!-- 日志文件地址 -->
    <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>WEB-INF/classes/log4j.properties</param-value>
    </context-param>
    <filter>
    <filter-name>setCharter</filter-name>
    <filter-class>tsrj.hxjk.pub.filter.SetCharterFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>GBK</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>setCharter</filter-name>
    <url-pattern>*.do</url-pattern>
    </filter-mapping>
    <!-- 配置Log日志 -->
    <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>
    <!-- Spring配置加载上下文 -->
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

      <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>0</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
      <jsp-config>
    <taglib>
    <taglib-uri>/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/struts-nested.tld</taglib-uri>
    <taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/struts-tiles.tld</taglib-uri>
    <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/c.tld</taglib-uri>
    <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/fmt.tld</taglib-uri>
    <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
    </taglib>
    </jsp-config>
    </web-app>
    ************************************************************************
      

  4.   

    页面文件代码
    **************************************************************************
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ taglib uri="/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/struts-tiles.tld" prefix="tiles" %><html:html>
      <head>    
        <title>购物车测试页面</title>   
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->  </head>
      
      <body onload="query();">
        <div align="center"><h1>购物车测试页面</h1></div>
        <hr width="100%"/><div align="center">
        <logic:present name="list" scope="request">
    <logic:iterate id="map" name="list" scope="request">
    <td nowrap="nowrap">
    <bean:write name="map" property="physic_id"/>
    </td>
    <td nowrap="nowrap">
    <bean:write name="map" property="physic_name"/>
    </td>
    <td nowrap="nowrap">
    <bean:write name='map' property='Secoff_id'/>
    </td>
    <td nowrap="nowrap">
    <bean:write name="map" property="Physic_pric"/>
    </td>
    <td nowrap="nowrap">
    <input type="button" value="放入购物车">
    </td>
    </logic:iterate>
    </logic:present>  
        
        <hr width="100%">   
        <form action="" method="get" name="buyForm"></form> 
      </body>
    </html:html>
    <script type="text/javascript">
    <!--
    //onload="query();"
    function query(){  
    document.forms["buyForm"].action ="../test.do?cmd=init";
    document.forms["buyForm"].target = "_self";
    document.forms["buyForm"].submit();
    }
    //-->
    </script>
      

  5.   

    你的问题有俩个方面发生
    1:你的jdk你的编译时和web工程的的java_home是一样的吗
    2,你的action的包结构是否写对了 (struct-config。xml)
      

  6.   

    都一样的!struts-config.xml编译过了!也能找到,但是就是找不到org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
      

  7.   

    你配置错了当然抱找不到action了 因为你的spring配置文件根本就没成功初始化
    你可以写个单独的类用Spring ApplicationContext对象把你的Spring配置文件读一下至少也有个准确的错误
    告诉你 
      

  8.   

    请问如何初始化spring 配置文件呢?   在web.xml文件中如何初始化???
      

  9.   

    Resource resource=new ClassPathResource("applicationContext.xml");
    BeanFactory factory=new XmlBeanFactory(resource);
    Service service = (Service)factory .getBean("Service");
    applicationContext.xml这个放在src下
      

  10.   

    放到src下面之后是不是还要在web.xml中配置一下呢?我是初学者请大哥多多指教