01 /**
02 *
03 * All content copyright (c) 2003-2008 Terracotta, Inc.,
04 * except as may otherwise be noted in a separate copyright notice.
05 * All rights reserved.
06 *
07 */
08 package demo.tasklist.action;
09
10 import demo.tasklist.common.Constants;
11 import demo.tasklist.service.DataKeeper;
12 import javax.servlet.http.HttpServletRequest;
13 import javax.servlet.http.HttpServletResponse;
14 import javax.servlet.http.HttpSession;
15 import org.apache.struts.action.Action;
16 import org.apache.struts.action.ActionForm;
17 import org.apache.struts.action.ActionForward;
18 import org.apache.struts.action.ActionMapping;
19
20 /**
21 * WelcomeAction initializes objects used by displayUserList.jsp
22 *
23 *@author Terracotta, Inc.
24 */
25 public class WelcomeAction extends Action {
26 public ActionForward execute(ActionMapping mapping,
27 ActionForm form,
28 HttpServletRequest request,
29 HttpServletResponse response)
30 throws Exception {
31
32 HttpSession session = request.getSession();
33
34 if (session.getAttribute(Constants.DATA_KEY) == null) {
35 DataKeeper dkeeper = new DataKeeper();
36 session.setAttribute(Constants.DATA_KEY, dkeeper);
37 }
38 return mapping.findForward(Constants.SUCCESS_KEY);
39 }
40 }
|