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.townsend.action;
09
10 import demo.townsend.common.Constants;
11 import demo.townsend.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 display.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 if (session.getAttribute(Constants.DATA_KEY) == null) {
34 DataKeeper dkeeper = new DataKeeper();
35 session.setAttribute(Constants.DATA_KEY, dkeeper);
36 }
37 return mapping.findForward(Constants.SUCCESS_KEY);
38 }
39 }
|