Answered step by step
Verified Expert Solution
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
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("
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started