Hi,
here's my code.
I want to show an error message if it's impossible to commit.
and it works, but at the second time I submit.
the first time, it seems that it did not take it.. It shows the message that I
put in the action before...(inside the invoke...)
is it a stack problem?
can anybody help me?
public String intercept(ActionInvocation invocation) throws Exception {
String retour = Action.ERROR;
try {
sf.getCurrentSession().beginTransaction();
retour = invocation.invoke();
sf.getCurrentSession().getTransaction().commit();
} catch(Exception e) {
try{
Transaction tx = sf.getCurrentSession().getTransaction();
if(tx != null && tx.isActive()) {
tx.rollback();
}
}catch (Exception e1) {
e1.printStackTrace();
}
retour = Action.ERROR;
MyActionSupport myActionSupport = (MyActionSupport)
invocation.getAction();
myActionSupport.clearMessages();
myActionSupport.addActionError("error");
}
return retour;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]