还是spring管理action的问题啊,action不能实例化

J2EE 码拜 9年前 (2015-04-10) 1047次浏览 0个评论

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

还是spring管理action的问题啊,action不能实例化
15分
把你的jsp的请求贴出来看看
还是spring管理action的问题啊,action不能实例化
15分
还有请求的action类贴出来看看
还是spring管理action的问题啊,action不能实例化
引用 1 楼 l13141588 的回复:

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

嘿嘿,搞定了,谢谢这位兄台

还是spring管理action的问题啊,action不能实例化
引用 1 楼 l13141588 的回复:

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

引用 2 楼 l13141588 的回复:

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

嘿嘿,搞定了,也谢谢这位兄台


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

文章评论已关闭!