配置了却报错说找不到action

菜鸟阿文 发布于 2016/04/28 10:48
阅读 308
收藏 0

spring配置:

<bean id="userAction" class="com.cuc.uaction.UserAction" scope="prototype">
   <property name="userDAO" ref="userDAO"></property>
</bean>


<bean id="userDAO" class="com.cuc.dao.imp.UserDAO" >
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>

<!-- 配置sessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="datasource"></property>
<property name="configLocation" value="classpath:hibernate.cfg.xml">
</property>
</bean>




<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>

<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager" >
<tx:attributes>
<tx:method name="insert*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="change*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>

<!-- 那些类的哪些方法参与事务 -->
  <aop:config>
  <aop:pointcut id="allServiceMethod" expression="execution(* com.cuc.dao.imp.*.*(..))"/>
  <aop:advisor advice-ref="txAdvice" pointcut-ref="allServiceMethod"/>
  </aop:config>



jsp:

<form onsubmit="return check_form()" name="update-form" target="_self" method="post" style="float: left;" action="<%=basePath%>user_update.action">


UserAction:

public String update() throws Exception{
HttpServletRequest request = ServletActionContext.getRequest();

............

}


type Exception report

message Invalid action class configuration that references an unknown class named [userAction]

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [userAction]
.........

root cause

java.lang.ClassNotFoundException: userAction
..........

加载中
0
smallsun512
smallsun512

你用了spring-mvc 吗?看下@contorller注解吧

0
温安适
温安适
XXAction,看来你使用了struct,建议配置struct部分内容,或者使用Spring MVC
0
让您贱笑了
让您贱笑了

用struts的话就在struts配置文件里配置user_update;

用springmvc的话就配置好action的return映射和@RequestMapping;

还有,看你报错应该是用的struts的通配吧,这样<action name="*_*" method="{2}" class="{1}Action" >

0
菜鸟阿文
菜鸟阿文

引用来自“让您贱笑了”的评论

用struts的话就在struts配置文件里配置user_update;

用springmvc的话就配置好action的return映射和@RequestMapping;

还有,看你报错应该是用的struts的通配吧,这样<action name="*_*" method="{2}" class="{1}Action" >

通配是说我用的这个吗?

struct:

<action name="user_*" class="userAction" method="{1}">

spring:

<tx:advice id="txAdvice" transaction-manager="transactionManager" >
<tx:attributes>
<tx:method name="insert*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="change*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>

返回顶部
顶部