1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package jdbcadmin.web.actions;
21
22 import javax.servlet.http.HttpServletRequest;
23 import javax.servlet.http.HttpServletResponse;
24
25 import jdbcadmin.web.ContexteManager;
26
27 import org.apache.struts.action.Action;
28 import org.apache.struts.action.ActionForm;
29 import org.apache.struts.action.ActionForward;
30 import org.apache.struts.action.ActionMapping;
31
32 /***
33 * Base class for all actions that need that the user passed by the index.
34 * @author Thomas Recloux (trecloux@norsys.fr)
35 */
36 public abstract class IndexedAction extends Action {
37
38 /***
39 * {@inheritDoc}
40 */
41 public final ActionForward execute(ActionMapping mapping, ActionForm form,
42 HttpServletRequest request, HttpServletResponse response) throws Exception {
43
44
45 if (ContexteManager.isInitialized(request)) {
46 return indexedExec(mapping, form, request, response);
47 } else {
48 return mapping.findForward("index");
49 }
50 }
51
52 /***
53 * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping,
54 * org.apache.struts.action.ActionForm,
55 * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
56 */
57 public abstract ActionForward indexedExec(ActionMapping mapping, ActionForm form,
58 HttpServletRequest request, HttpServletResponse response) throws Exception;
59
60 }