ssh整合关于action问题

重走十年 2016-08-04 02:38:22
希望实现:再添加(addEmp)完成之后跳转到(getEmp)显示所有员工,
结果:能添加成功,页面无法显示。
页面报错:HTTP Status 500 - Unable to instantiate Action, empAction, defined for 'addEmp' in namespace '/'empAction
struts配置:
applicationContext.xml配置:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
">

<!-- 开启对注解的支持 -->
<context:annotation-config/>
<!-- 扫描src下所有的包 -->
<context:component-scan base-package="*"/>


<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="url"
value="jdbc:oracle:thin:@localhost:1521:orcl">
</property>
<property name="username" value="scott"></property>
<property name="password" value="123"></property>
<property name="driverClassName" value="oracle.jdbc.OracleDriver"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
<prop key="hibernate.show_sql">
true
</prop>
<prop key="hibernate.format_sql">
true
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>entity/Emp.hbm.xml</value>
<value>entity/Dept.hbm.xml</value></list>
</property></bean>

<!-- 定义一个事务管理器 -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<!-- 既然要将事务交给spring中管理,那么就要用到sessionFactory
,就需要将sessionFactroy注入到HibernateTransactionManager -->
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 定义事务的增强 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<!-- 当为查询时,可定义 read-only="true" 可以提高我们查询的效率,优化查询的性能-->
<tx:method name="get*" read-only="true" />
<!-- propagation="REQUIRED" 当存在一个事务的事务支持当前事务,如果当前方法没有事务就开启一个新的事务 -->
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="save*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<!-- 定义切面 -->
<aop:config>
<!-- 定义切入点 -->
<aop:pointcut id="serviceMethod" expression="execution(* service..*.*(..))"/>
<!-- 将事务增强和切入点组合 -->
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod"/>
</aop:config>
<!-- hibernatetemplate模板类 -->
<bean class="org.springframework.orm.hibernate3.HibernateTemplate" id="hibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean></beans>
...全文
91 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
重走十年 2016-08-04
  • 打赏
  • 举报
回复
重走十年 2016-08-04
  • 打赏
  • 举报
回复
重走十年 2016-08-04
  • 打赏
  • 举报
回复
HTTP Status 500 - Unable to instantiate Action, empAction, defined for 'addEmp' in namespace '/'empAction HTTP状态500 -无法实例化行动,empAction,为“addEmp”名称空间定义empAction“/”

5,658

社区成员

发帖
与我相关
我的任务
社区描述
Web开发应用服务器相关讨论专区
社区管理员
  • 应用服务器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧