1.Mysql连接数据库出现java/sql/SQLClientInfoException
解决:在eclipse中选择eclipse自带的jre即可。
2.struts2,hibernate,spring 出现No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
解决:1.struts的action不应有任何关于事务的返回值,也就是getManager方法
2.正确配置spring的事务
3.struts2获取response
strus 配置(struts的action可以返回void的)
解决:在eclipse中选择eclipse自带的jre即可。
2.struts2,hibernate,spring 出现No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
解决:1.struts的action不应有任何关于事务的返回值,也就是getManager方法
2.正确配置spring的事务
<!-- 事务 begin -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 支持 @AspectJ -->
<aop:aspectj-autoproxy/>
<!-- 使用annotation定义事务 -->
<tx:annotation-driven transaction-manager="transactionManager" />
3.struts2获取response
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("text/plain "); //text/xml
PrintWriter pw = response.getWriter();
pw.print("true");
strus 配置(struts的action可以返回void的)
<action name="uploadTest" class="com.jj.action.FileUpload" method="upload">
<result type="plaintext"></result>
</action>