]> WPIA git - gigi.git/blob - src/club/wpia/gigi/pages/ManagedFormPage.java
fix: ResultSet.getDate is often wrong as it fetches day-precision times
[gigi.git] / src / club / wpia / gigi / pages / ManagedFormPage.java
1 package club.wpia.gigi.pages;
2
3 import java.io.IOException;
4 import java.util.HashMap;
5
6 import javax.servlet.http.HttpServletRequest;
7 import javax.servlet.http.HttpServletResponse;
8
9 import club.wpia.gigi.output.template.Form;
10
11 public abstract class ManagedFormPage extends Page {
12
13     Class<? extends Form> c;
14
15     public ManagedFormPage(String title, Class<? extends Form> t) {
16         super(title);
17         c = t;
18     }
19
20     @Override
21     public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
22         if (Form.printFormErrors(req, resp.getWriter())) {
23             Form form = Form.getForm(req, c);
24             form.output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
25         }
26     }
27
28     @Override
29     public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
30         return Form.getForm(req, c).submitExceptionProtected(req, resp);
31     }
32
33 }