01: /*
02: * Created on 04 mai. 2004 by the Message Center Team
03: *
04: */
05: package mc.formgenerator.servlets.bonita;
06:
07: import java.io.IOException;
08:
09: import javax.servlet.http.HttpServlet;
10: import javax.servlet.http.HttpServletRequest;
11: import javax.servlet.http.HttpServletResponse;
12: import javax.servlet.http.HttpSession;
13:
14: /**
15: * Servlet that will show user his todo list in order to allow him to start an activity
16: */
17: public class ServletActivityToDoList extends HttpServlet {
18:
19: /**
20: * Servlet reaction on get method : Displaying todo list associated to the project
21: */
22: protected void doGet(HttpServletRequest request,
23: HttpServletResponse response) throws IOException {
24:
25: //Get current session
26: HttpSession session = request.getSession(true);
27:
28: //Parameter value
29: String projectName = request.getParameter("projectName");
30:
31: //Project name must be specified
32: if (projectName == null)
33: throw new IOException("projectName parameter empty");
34:
35: else {
36: //We create the model for this controller
37: ModelActivityToDoList modelActivityToDoList = new ModelActivityToDoList();
38:
39: //Stores the model in the session
40: session.setAttribute("modelActivityToDoList",
41: modelActivityToDoList);
42:
43: try {
44: //Model processing
45: modelActivityToDoList.process(projectName);
46:
47: //Request redirection in order to build the client response
48: this .getServletContext().getRequestDispatcher(
49: "/web/jsp/toDoList.jsp").forward(request,
50: response);
51: }
52:
53: catch (Exception e) {
54: e.printStackTrace();
55: response.sendError(
56: HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e
57: .getMessage());
58: }
59: }
60: }
61: }
|