Question: Program 4.1 below shows the use of a single code do Everything.jsp to handle both the request and response, to handle database access and to

Program 4.1 below shows the use of a single code do Everything.jsp to handle both the request and response, to handle database access and to perform the business logic processing. 1 2 3 4 5
- 6 7 try { 8 Connection conn = null; 9 Class.forName ("com.mysql.jdbc.Driver"); 10 conn = 11 DriverManager.getConnection ("jdbc:mysql://localhost/covid19 12 ","root", ""); 13 String sql = "SELECT id, name, address FROM patients 14 WHERE cause="" 15 +request.getParameter("cause") +"""; 16 Statement stmt = conn.createStatement(); 17 ResultSet rs = stmt.executeQuery (sql); 18 19 out.print("
Patient List: Ward 2021
"); 20 out.print("- "); 21 while (rs.next()) { 22 out.print("
- Patient Detail "); 23 out.println(" Patient ID 24 "+rs.getString("id")); 25 out.println(" Name : "+rs.getString("name")); 26 out.println(" Address : 27 "+rs.getString("address")); 28 out.print(" "); 29 ) 30 out.print("
"); 31 32 } catch (Exception ex) { 33 ex.printStackTrace(); 34 35 36 %> 37 38 39 a) Analyse and argue why Program 4.1 above is considered as a bad design practice. (2 marks) b) Explain how Model View Controller (MVC) design pattern is better than the design applied in Program 4.1. (2 marks) 4 c) Illustrate suitable diagram to depict MVC design pattern and how the program entities in Program 4.1 interacts with each other to accomplish tasks. (4 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
