还是spring管理action的问题啊,action不能实例化,求各位帮助

J2EE 码拜 9年前 (2016-03-20) 1326次浏览
struts.xml
<constant name=”struts.objectFactory” value=”spring“></constant>
<!– struts2的扩展名,例如struts1的时候,用的.do,struts2默认为.action,可以改成其它的,例如.dxd –>
<constant name=”struts.action.extension” value=”action”></constant>
<!– 资源文件 –>
<constant name=”struts.custom.i18n.resources” value=”messageResource”></constant>
<package name=”register1″ namespace=”/” extends=”struts-default”>
<action name=”showIndex”>
<result name=”success”>/WEB-INF/pages/index.jsp</result>
</action>
<action name=”register” class=”registerAction” method=”addUser”>
<result name=”success”>/WEB-INF/pages/welcome.jsp</result>
<result name=”input”>/WEB-INF/pages/error.jsp</result>
</action>
</package>
applicationContext.xml
<bean id=”registerAction” class=”com.broada.demo.action.RegisterAction” scope=”prototype”>
<property name=”userserviceImpl” ref=”userserviceId”></property>
</bean>
<bean id=”userdaoId” class=”com.broada.demo.daoImpl.UserDaoImpl”>
<property name=”sqlMapClient” ref=”sqlMapClient”></property>
</bean>
<bean id=”userserviceId” class=”com.broada.demo.serviceImpl.UserServiceImpl”>
<property name=”userdaoImpl” ref=”userdaoId”/>
</bean>
<bean id=”sqlMapClient” class=”org.springframework.orm.ibatis.SqlMapClientFactoryBean”>
<property name=”configLocation”>
<value>/WEB-INF/ibatis/SqlMapConfig.xml</value>
</property>
<property name=”dataSource”>
<ref bean=”dataSource”/>
</property>
</bean>
web.xml
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/applicationContext-*.xml</param-value>
</context-param>
<!– struts2模块 –>
<filter>
<filter-name>struts2</filter-name>
<!– struts2的核心过滤器 –>
<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>
控制台报错
2014-9-30 13:49:49 org.apache.struts2.dispatcher.Dispatcher error
严重: Exception occurred during processing request: Unable to instantiate Action, registerAction,  defined for “login” in namespace “/”registerAction
Unable to instantiate Action, registerAction,  defined for “login” in namespace “/”registerAction
解决方案

15

把你的jsp的请求贴出来看看

15

还有请求的action类贴出来看看

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明还是spring管理action的问题啊,action不能实例化,求各位帮助
喜欢 (0)
[1034331897@qq.com]
分享 (0)