2018.
Java Servlet Page
<%--
Document : p2018
Created on : Nov 14, 2022, 11:53:51 AM
Author : Ali
--%>
<%@page import="[Link]"%>
<%@page import="[Link].*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> JSP Page</title>
<style>
div{
display: flex;
justify-content: center;
}
table{
border-collapse: collapse;
}
th,td,tr,table{
border: 1px solid black;
padding: 10px;
}
</style>
</head>
<body>
<div>
<table>
<tr>
<th>Politician Name</th>
<th>Politician Current Party Name</th>
</tr>
<%
try{
[Link]("[Link]");
Connection con =
[Link]("jdbc:mysql://localhost:3306/database?useSSL=false","root","root");
Statement st = [Link]();
ResultSet rs = [Link]( "select * from politician" );
while([Link]()){
%>
<tr>
<td><%=[Link]("pol_Name")%> </td>
<td><%=[Link]("pol_Party")%> </td>
</tr>
<%}
}
catch(Exception e){
}
%>
</table>
</div>
</body>
</html>
2018. Servlet
package [Link];
import [Link].*;
import [Link];
import [Link].*;
import [Link].*;
import [Link].*;
/**
*
* @author Ali
*/
public class p20181 extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException,
ServletException {
PrintWriter out = [Link]();
[Link]("text/html");
[Link]("<html><body>");
try{
[Link]("[Link]");
Connection con =
[Link]("jdbc:mysql://localhost:3306/database?useSSL=false","root","root");
Statement st = [Link]();
ResultSet rs = [Link]( "select * from item" );
[Link]("<h1>Items</h1>");
[Link]("<ol>");
while ([Link]() ){
String item = [Link]("item_Name");
Number nitem = [Link]("no_of_items");
[Link]("<li>" + item + "<b> Quantity: </b>" + nitem + "</li>");
}
[Link]("</ol>");
[Link]("</body></html>");
}
catch(Exception e){
}
}
}
2019. Java Servlet Page
<%--
Document : p2019
Created on : Nov 14, 2022, 7:30:43 PM
Author : Ali
--%>
<%@page import="[Link]"%>
<%@page import="[Link].*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> JSP Page</title>
</head>
<body>
<label> Choose a model: </label>
<select>
<option>Select</option>
<%
try{
[Link]("[Link]");
Connection con =
[Link]("jdbc:mysql://localhost:3306/database?useSSL=false","root","root");
Statement st = [Link]();
ResultSet rs = [Link]( "select * from smartphone" );
while([Link]()){
%>
<option><%= [Link]("model") + " - " + [Link]("company")%> </option>
<%}
}
catch(Exception e){
}
%>
</select>
</body>
</html>
2019. Servlet
package [Link];
import [Link].*;
import [Link];
import [Link].*;
import [Link].*;
import [Link].*;
/**
*
* @author Ali
*/
public class p20191 extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException,
ServletException {
PrintWriter out = [Link]();
[Link]("text/html");
[Link]("<html><body>");
try{
[Link]("[Link]");
Connection con =
[Link]("jdbc:mysql://localhost:3306/database?useSSL=false","root","root");
Statement st = [Link]();
ResultSet rs = [Link]( "select * from country" );
[Link]("<h1>Countries</h1>");
[Link]("<ol>");
while ([Link]() ){
String item = [Link]("name");
String nitem = [Link]("capital_city");
[Link]("<li>" + item + "<b> Capital: </b>" + nitem + "</li>");
}
[Link]("</ol>");
[Link]("</body></html>");
}
catch(Exception e){
}
}
}
2020. Java Servlet Page
<%--
Document : p2020
Created on : Nov 14, 2022, 8:27:28 PM
Author : Ali
--%>
<%@page import="[Link]"%>
<%@page import="[Link].*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> JSP Page</title>
</head>
<body>
<ul>
<%
try{
[Link]("[Link]");
Connection con =
[Link]("jdbc:mysql://localhost:3306/database?useSSL=false","root","root");
Statement st = [Link]();
ResultSet rs = [Link]( "select * from corona1" );
while([Link]()){
%>
<li><%=[Link]("ward_incharge") + " / "
+[Link]("hospital_name") + " , " + [Link]("hospital_location")%> </li>
<%}
}
catch(Exception e){
}
%>
</ul>
</body>
</html>
2020. Servlet
package [Link];
import [Link].*;
import [Link].*;
import [Link].*;
import [Link].*;
/**
*
* @author Ali
*/
public class p20201 extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException,
ServletException {
PrintWriter out = [Link]();
[Link]("text/html");
[Link]("<html><body><table border=1 width=30%>");
[Link]("<tr><th>Patient Name</th>");
[Link]("<th>Patient CNIC</th>");
[Link]("<th>Patient Location</th></tr>");
try{
[Link]("[Link]");
Connection con =
[Link]("jdbc:mysql://localhost:3306/database?useSSL=false","root","root");
Statement st = [Link]();
ResultSet rs = [Link]( "select * from corona" );
while ([Link]() ){
[Link]("<tr><td>" + [Link]("patient_name") + "</td>");
[Link]("<td>" + [Link]("patient_cnic") + "</td>");
[Link]("<td>" + [Link]("patient_location") + "</td></tr?");
}
}
catch(Exception e){
}
}
}
2021. Java Servlet Page
<%--
Document : p2021
Created on : Nov 14, 2022, 9:10:26 PM
Author : Ali
--%>
<%@page import="[Link]" %>
<%@page import="[Link].*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> JSP Page</title>
<style>
div{
display: flex;
justify-content: center;
}
table{
border-collapse: collapse;
}
th,td,tr,table{
border: 1px solid black;
padding: 10px;
}
</style>
</head>
<body>
<div>
<table>
<tr>
<th>Area Name</th>
<th>City Name</th>
<th>No. of patients</th>
<th>No. of days</th>
</tr>
<%
try{
[Link]("[Link]");
Connection con =
[Link]("jdbc:mysql://localhost:3306/database?useSSL=false","root","root");
Statement st = [Link]();
ResultSet rs = [Link]( "select * from smartlockdown" );
while([Link]()){
%>
<tr>
<td><%=[Link]("area_name")%> </td>
<td><%=[Link]("city_name")%> </td>
<td><%=[Link]("no_of_patients")%> </td>
<td><%=[Link]("no_of_days")%> </td>
</tr>
<%}
}
catch(Exception e){
}
%>
</table>
</div>
</body>
</html>