这是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 [/ShoppingOnNet].
有这个错首先检查是否有action=Test的配置,一看你没有,你有个Text,问题解决。