ja3


  1. Write a JSP program to display the details of Patient (PNo, PName, Address, age,
    disease) in tabular form on browser. [15 M]
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Patient Details</title> </head> <body> <h1>Patient Details</h1> <table border="1"> <tr> <th>Patient Number</th> <th>Patient Name</th> <th>Address</th> <th>Age</th> <th>Disease</th> </tr> <%-- Assuming patients is a List<Patient> containing patient objects with attributes pno, pname, address, age, disease --%> <% for (Patient patient : patients) { %> <tr> <td><%= patient.getPNo() %></td> <td><%= patient.getPName() %></td> <td><%= patient.getAddress() %></td> <td><%= patient.getAge() %></td> <td><%= patient.getDisease() %></td> </tr> <% } %> </table> </body> </html>
  1. Write a Java program to create LinkedList of String objects and perform the following:
    i. Add element at the end of the list
    ii. Delete first element of the list
    iii. Display the contents of list in reverse order
    import java.util.LinkedList;

public class StringLinkedList {
public static void main(String[] args) {
// Create a LinkedList of String objects
LinkedList<String> list = new LinkedList<>();

    // Add elements at the end of the list
    list.add("Apple");
    list.add("Banana");
    list.add("Orange");
    
    // Display the contents of the list
    System.out.println("Contents of the list:");
    System.out.println(list);
    
    // Delete the first element of the list
    String removed = list.removeFirst();
    System.out.println("Removed element: " + removed);
    
    // Display the contents of the list in reverse order
    System.out.println("Contents of the list in reverse order:");
    for (int i = list.size() - 1; i >= 0; i--) {
        System.out.println(list.get(i));
    }
}

}