ssh项目在运行时控制台没有出错,但是页面出现
HTTP Status 500 - No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here怎么解决???
applicationContext.xml文件配置如下:
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<property name="maxActive" value="100"></property>
<property name="maxIdle" value="30"></property>
<property name="maxWait" value="500"></property>
<property name="defaultAutoCommit" value="true"></property>
<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.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>vo/News.hbm.xml</value></list>
</property></bean>
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
tx:attributes
<!-- 只有一save、delete、update开头的方法才能执行增删改操作 -->
<!-- 其他方法为只读方法 -->
/tx:attributes
/tx:advice
aop:config
<!-- 对应实现类接口的包的位置 -->
/aop:config
<!-- 业务层Service -->
<bean id="news_service" class="service.impl.NewsServiceImpl">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
<!-- 控制层Action -->
<bean id="news_action" class="action.NewsAction">
<property name="news_services">
<ref bean="news_service" />
</property>
</bean>
</beans>
初学ssh的菜鸟,请各位大神帮忙解答一下!!谢谢!