1 /*
2 * Demosys.
3 *
4 * Terms of license - http://opensource.org/licenses/apachepl.php
5 */
6 package org.demosys.web.iteration.action;
7 import javax.servlet.http.Cookie;
8 import javax.servlet.http.HttpServletRequest;
9 import javax.servlet.http.HttpServletResponse;
10 import javax.swing.*;
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 import org.demosys.web.ServiceLocator;
16 import org.demosys.web.iteration.CreateIterationException;
17 import org.demosys.web.iteration.IterationForm;
18 /***
19 */
20 public class NewIterationAction extends Action {
21 public ActionForward execute(ActionMapping mapping, ActionForm objForm,
22 HttpServletRequest request, HttpServletResponse response) {
23 IterationForm form = (IterationForm)objForm;
24
25 String result = null;
26
27 try {
28 ServiceLocator.getServiceLocator().getIterationService().newIteration(form
29 .toIterationView());
30
31 String title = request.getParameter("title");
32 Cookie myCookieIteration = new Cookie("CookieTitle", title);
33 myCookieIteration.setMaxAge(365 * 24 * 60 * 60);
34 myCookieIteration.setPath("/");
35 response.addCookie(myCookieIteration);
36
37 result = "success";
38 }
39 catch (CreateIterationException e) {
40 e.printStackTrace();
41 result = "failure";
42 }
43
44 return mapping.findForward(result);
45 }
46 }
This page was automatically generated by Maven