]> WPIA git - gigi.git/blobdiff - src/club/wpia/gigi/output/template/Form.java
upd: get default variables into outputables for error messages
[gigi.git] / src / club / wpia / gigi / output / template / Form.java
index ec3909e11263da0e5b23e1ebbcf6c4093d9d1744..6b895b7c9665d31872ffd517cacdc41a3289d1ff 100644 (file)
@@ -136,17 +136,18 @@ public abstract class Form implements Outputable {
         try {
             SubmissionResult res = submit(req);
             req.setAttribute(SUBMIT_RESULT, res);
-            if (res instanceof RedirectResult) {
-                resp.sendRedirect(((RedirectResult) res).target);
-                return true;
-            }
             if (res.endsForm()) {
                 HttpSession hs = req.getSession();
                 hs.removeAttribute("form/" + getClass().getName() + "/" + csrf);
             }
+            if (res instanceof RedirectResult) {
+                resp.sendRedirect(((RedirectResult) res).target);
+                return true;
+            }
             return false;
         } catch (PermamentFormException e) {
             req.setAttribute(SUBMIT_RESULT, e);
+            req.getSession().removeAttribute("form/" + getClass().getName() + "/" + csrf);
             return false;
         } catch (GigiApiException e) {
             req.setAttribute(SUBMIT_RESULT, e);
@@ -167,11 +168,11 @@ public abstract class Form implements Outputable {
     public static boolean printFormErrors(HttpServletRequest req, PrintWriter out) {
         Object o = req.getAttribute(SUBMIT_RESULT);
         if (o != null && (o instanceof PermamentFormException)) {
-            ((PermamentFormException) o).getCause().format(out, Page.getLanguage(req));
+            ((PermamentFormException) o).getCause().format(out, Page.getLanguage(req), Page.getDefaultVars(req));
             return false;
         }
         if (o != null && (o instanceof GigiApiException)) {
-            ((GigiApiException) o).format(out, Page.getLanguage(req));
+            ((GigiApiException) o).format(out, Page.getLanguage(req), Page.getDefaultVars(req));
             return true;
         }
         if (o != null && (o instanceof FormContinue)) {