WelcomeAction.java
01 /*
02  *
03  * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
04  *
05 */
06 package demo.townsend.action;
07 
08 import demo.townsend.common.Constants;
09 import demo.townsend.service.DataKeeper;
10 import javax.servlet.http.HttpServletRequest;
11 import javax.servlet.http.HttpServletResponse;
12 import javax.servlet.http.HttpSession;
13 import org.apache.struts.action.Action;
14 import org.apache.struts.action.ActionForm;
15 import org.apache.struts.action.ActionForward;
16 import org.apache.struts.action.ActionMapping;
17 
18 /**
19  * WelcomeAction initializes objects used by display.jsp 
20  */
21 public class WelcomeAction extends Action {
22    public ActionForward executeActionMapping mapping,
23                                  ActionForm form,
24                                  HttpServletRequest request,
25                                  HttpServletResponse response)
26     throws Exception {
27 
28       HttpSession session = request.getSession();
29       if (session.getAttribute(Constants.DATA_KEY== null) {
30         DataKeeper dkeeper = new DataKeeper();
31         session.setAttributeConstants.DATA_KEY, dkeeper);
32       }
33       return mapping.findForward(Constants.SUCCESS_KEY );
34   }
35 }