Presentation is loading. Please wait.

Presentation is loading. Please wait.

SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.

Similar presentations


Presentation on theme: "SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin."— Presentation transcript:

1 SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin

2 Agenda – Lecture 10a Review & renew. Controller Patterns
Some solutions to exercise set 9. Controller Patterns GRASP EA 11/10/2018 SOEN 343, © P.Chalin,

3 Do-it-all Servlet Redesign solutions: lect09.ppt SOEN 343, © P.Chalin,
11/10/2018 SOEN 343, © P.Chalin,

4 Presentation Domain Data Source Controller Patterns Page Controller
Template View Presentation Front Controller Transform View Domain Model Transaction Script Domain Data Mapper Active Record Table Module Data Mapper Row Data Gateway Table Data Gateway Data Source Table Data Gateway 11/10/2018 SOEN 343, © P.Chalin,

5 Page Controller 11/10/2018 SOEN 343, © P.Chalin,

6 A1 Page Controllers protected void processRequest(
HttpServletResponse response) throws ServletException, java.io.IOException // { TaskListHelper helper = new TaskListHelper(); try { ViewTaskListTS.execute(helper); } catch (Exception e) { helper.appendStatus(e.toString()); } if (helper.getTaskList() == null) { request.setAttribute("errorMessage", helper.getStatus()); forward("Error.jsp", request, response); } else { request.setAttribute("helper", helper); forward("TaskManager.jsp", request, response); 11/10/2018 SOEN 343, © P.Chalin,

7 A1 Page Controllers protected void processRequest(…) throws … {
TaskListHelper helper = new TaskListHelper(); try { ViewTaskListTS.execute(helper); } catch (Exception e) { helper.appendStatus(e.toString()); } if (helper.getTaskList() == null) { request.setAttribute("errorMessage", helper.getStatus()); forward("Error.jsp", request, response); } else { request.setAttribute("helper", helper); forward("TaskManager.jsp", request, response); 11/10/2018 SOEN 343, © P.Chalin,

8 Page Controller vs. Front Controller – Differences in URL
11/10/2018 SOEN 343, © P.Chalin,

9 Page Controllers for A1 http:/stu.cs/343A1/ViewTaskList
11/10/2018 SOEN 343, © P.Chalin,

10 Front Controller for A1 Base URL: http:/stu.cs/343A1/frontController
…/frontController ?command=ViewTaskList …/frontController ?command=AddTaskGrade&title=abc&… 11/10/2018 SOEN 343, © P.Chalin,

11 Front Controller 11/10/2018 SOEN 343, © P.Chalin,

12 Front Controller 11/10/2018 SOEN 343, © P.Chalin,

13 Front Controller (Fowler) Command (GoF) Patterns
FrontCommand + init ( ) + processRequest ( ) RemoveStudentCommand ViewStudInfoCommand + processRequest ( ) + processRequest ( ) 11/10/2018 SOEN 343, © P.Chalin,

14 Front Controller: Sequence Diagram
11/10/2018 SOEN 343, © P.Chalin,

15 Front Controller: ProcessRequest
11/10/2018 SOEN 343, © P.Chalin,

16 Front Controller (cont’d)
11/10/2018 SOEN 343, © P.Chalin,

17 Assignment 2: Front Controller Solution
11/10/2018 SOEN 343, © P.Chalin,

18 Front Controller: Advantages?
11/10/2018 SOEN 343, © P.Chalin,


Download ppt "SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin."

Similar presentations


Ads by Google