日期:2014-05-18  浏览次数:20677 次

spring2.5整合struts2.3,发布运行,没有任何异常,但是访问不了action
这是struts.xml的配置

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!--开发模式-->
 <constant name="struts.devMode" value="true" />
 <constant name="struts.multipart.paeser" value="cos" />
 
     <package name="default" namespace="/" extends="struts-default">
<action name="Text" class="TestAction">
<result>/index.jsp</result>
        </action>
       
    </package>
</struts>    


这是spring配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!-- 测试bean 
<bean id="test" class="com.lcx.model.domain.City">
<property name="name" value="德阳"></property>
</bean>  -->


<bean id="TestAction" class="com.lcx.controlor.action.TestAction" scope="prototype">

</bean>

</beans>

下面是TestAction类

package com.lcx.controlor.action;


import com.opensymphony.xwork2.ActionSupport;

public class TestAction extends ActionSupport
{
public String test()
{
return SUCCESS;
}
}


发布后我这样访问
http://localhost:8080/ShoppingOnNet/Test!test
页面说找不到action

Messages:
There is no Action mapped for namespace [/] and action name [Test] associated with context path [/ShoppingOnNet].

请问一下大家这怎么解决呢

------解决方案--------------------
我发现了。。
<action name="Text"
你的Test写成了Text

------解决方案--------------------
There is no Action mapped for namespace [/] and action name [Test] associated with context path