1、例如SSH中在數據庫連接失敗時進行增刪查改,會出現org.springframework.transaction.CannotCreateTransactionException的問題
(1)、在可能出現錯誤的方法throws?
public Session getSession() throws CannotCreateTransactionException {return sessionFactory.getCurrentSession();}
(2)、struts.xml
<global-results><result name="sqlexception">/sqlexception.jsp</result></global-results><global-exception-mappings><exception-mapping result="sqlexception" exception="org.springframework.transaction.CannotCreateTransactionException"></exception-mapping></global-exception-mappings>
struct python?如果出現這個exception,回轉到/sqlexception.jsp。
Done