草稿
function coco(i) { var myhttprequest=newXMLHttpRequest(); var changeback=zhunbei(myhttprequest,truefunction); myhttprequest.onreadystatechange=changeback; myhttprequest.open("POST","http://localhost:9000/coco/do",true); myhttprequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); myhttprequest.send("toto="+i); }[@more@]
处理Hibernate “save is not valid without active transaction”异常
原本代码:public Session getCurrentSession() {return HibernateUtil.getSessionFactory().getCurrentSession();}public void createUser(User user) {getCurrentSession().beginTransaction();getCurrentSession().save(user);getCurrentSession().getTransaction().commit();}提示错误信息:严重: Servlet.service() for servlet action threw exceptionorg.hibernate.HibernateException: save is not valid without active transactionat org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(Thr