首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

struts2-core-2.2.3.1+org.springframework.core-3.1.0.M2整合的有关问题

2011-12-14 
struts2-core-2.2.3.1+org.springframework.core-3.1.0.M2整合的问题啊啊!晕死,没法上传文件啊。我还想吧工

struts2-core-2.2.3.1+org.springframework.core-3.1.0.M2整合的问题
啊啊!晕死,没法上传文件啊。
我还想吧工程上传上来呢!!没办法了!

A...c.xml

XML code
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans>    <bean id="testService" class="test.TestImpl"></bean>    <bean id="testaction" class="test.TestAction">        <property name="testService" ref="testService"/>    </bean></beans>


Struts.xml
XML code
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"        "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>    <include file="struts-default.xml" />    <package name="test" extends="struts-default" >        <action name="test" class="testaction">            <result name="success">/test.jsp</result>        </action>    </package></struts>




web.xml
XML code
<?xml version="1.0" encoding="UTF-8"?><web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee     http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">    <welcome-file-list>        <welcome-file>index.jsp</welcome-file>    </welcome-file-list>    <filter>        <filter-name>struts2</filter-name>        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>    </filter>    <filter-mapping>        <filter-name>struts2</filter-name>        <url-pattern>/*</url-pattern>    </filter-mapping>    <listener>        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>    </listener>    <context-param>        <param-name>contextConfigLocation</param-name>        <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>    </context-param></web-app>


完了报500

Unable to instantiate Action, testaction, defined for 'test' in namespace '/'testaction
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:318)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:399)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:198)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)


------解决方案--------------------


不知道哦,帮顶一下。很久没用ssh了

帮顶,祝楼主好运
[解决办法]

Unable to instantiate Action, testaction, defined for 'test' in namespace '/'testaction
[解决办法]
Unable to instantiate Action, testaction, defined for 'test' in namespace '/'testaction
这种错一般都是不能实例化Action,testaction的命名空间错了,跟配置文件有关,但是我好像没看到什么错啊,要不lz把你xml配置文件中
<package name="test" extends="struts-default" >
<action name="test" class="testaction">
<result name="success">/test.jsp</result>
</action>
</package>
这两个的name名称改不同试试,不知道是不是他两相同起得冲突

热点排行