Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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("
  1. 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("
  2. "); 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

ISBN: 0262660709, 978-0262660709

More Books

Students also viewed these Databases questions

Question

Find y'. y= |x + X (x) (x) X 1 02x+ 2x 1 O 2x + 1/3 Ex 2x +

Answered: 1 week ago

Question

=+1 What would you do if you were the IHR manager?

Answered: 1 week ago