spring和hibernate整合的时候没问题,可是一加上struts2就出现找不到actionstruts.xml:
<struts>
<constant name="struts.objectFactory" value="spring" />
<package name="default" extends="struts-defult" namespace="/test" >
<action name="list" class="com.dlm.action.EmployeeAction">
<result type="redirect" name="LIST">/list.jsp</result>
</action>
</package>
</struts>spring是使用注解的方式注入applicationContext.xml: <context:component-scan base-package="com.dlm"></context:component-scan>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/ssh2?useUnicode=true&characterEncoding=utf-8"></property>
<property name="user" value="root"></property>
<property name="password" value="root"></property>
<property name="initialPoolSize" value="1"></property>
<property name="minPoolSize" value="1"></property>
<property name="maxPoolSize" value="300"></property>
<property name="maxIdleTime" value="60"></property>
<property name="acquireIncrement" value="5"></property>
<property name="idleConnectionTestPeriod" value="60"></property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mappingResources">
<list>
<value>com/dlm/domain/Employee.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true
hibernate.format_sql=false
</value>
</property>
</bean>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
不知道怎么老是找不到actionHTTP Status 404 - There is no Action mapped for action name emlist.--------------------------------------------------------------------------------type Status reportmessage There is no Action mapped for action name emlist.description The requested resource (There is no Action mapped for action name emlist.) is not available.
<struts>
<constant name="struts.objectFactory" value="spring" />
<package name="default" extends="struts-defult" namespace="/test" >
<action name="list" class="com.dlm.action.EmployeeAction">
<result type="redirect" name="LIST">/list.jsp</result>
</action>
</package>
</struts>spring是使用注解的方式注入applicationContext.xml: <context:component-scan base-package="com.dlm"></context:component-scan>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/ssh2?useUnicode=true&characterEncoding=utf-8"></property>
<property name="user" value="root"></property>
<property name="password" value="root"></property>
<property name="initialPoolSize" value="1"></property>
<property name="minPoolSize" value="1"></property>
<property name="maxPoolSize" value="300"></property>
<property name="maxIdleTime" value="60"></property>
<property name="acquireIncrement" value="5"></property>
<property name="idleConnectionTestPeriod" value="60"></property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mappingResources">
<list>
<value>com/dlm/domain/Employee.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true
hibernate.format_sql=false
</value>
</property>
</bean>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
不知道怎么老是找不到actionHTTP Status 404 - There is no Action mapped for action name emlist.--------------------------------------------------------------------------------type Status reportmessage There is no Action mapped for action name emlist.description The requested resource (There is no Action mapped for action name emlist.) is not available.
然后:http://localhost:8080/SSH2/list.action
试试