Please start new threads for new issues.

François Rouxel wrote:
I want to show an error message if it's impossible to commit.
> But it seems my action still display the 'success' result.

     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; }
        return retour;
    }

See http://struts.apache.org/2.x/docs/writing-interceptors.html, in particular the yellow note talking about PreResultListener.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to