01: /*
02: @COPYRIGHT@
03: */
04: package demo.townsend.action;
05:
06: import demo.townsend.common.Constants;
07: import demo.townsend.service.DataKeeper;
08: import javax.servlet.http.HttpServletRequest;
09: import javax.servlet.http.HttpServletResponse;
10: import javax.servlet.http.HttpSession;
11: import org.apache.struts.action.Action;
12: import org.apache.struts.action.ActionForm;
13: import org.apache.struts.action.ActionForward;
14: import org.apache.struts.action.ActionMapping;
15:
16: /**
17: * WelcomeAction initializes objects used by display.jsp
18: */
19: public class WelcomeAction extends Action {
20: public ActionForward execute(ActionMapping mapping,
21: ActionForm form, HttpServletRequest request,
22: HttpServletResponse response) throws Exception {
23:
24: HttpSession session = request.getSession();
25: if (session.getAttribute(Constants.DATA_KEY) == null) {
26: DataKeeper dkeeper = new DataKeeper();
27: session.setAttribute(Constants.DATA_KEY, dkeeper);
28: }
29: return mapping.findForward(Constants.SUCCESS_KEY);
30: }
31: }
|