OneCompiler

Sprint

1651

//Servlet

package com.web;
import java.sql.*;
import java.io.IOException;
import java.util.List;
import java.util.Random;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.insurancedao.InsuranceDAO;
import com.insurancemodel.Insurance;
import com.controller.Controller;
import com.dao.UnderWriterDao;
import com.model.UnderWriter;

@WebServlet("/UnderWriterServlet")
public class UnderWriterServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public UnderWriterServlet() {
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String action=request.getParameter("action");
RequestDispatcher rd=null;
Controller controller=new Controller();
if ("SearchById".equals(action)) {
int id = Integer.parseInt(request.getParameter("id"));
System.out.println("in search page"+id);
List<UnderWriter> p=controller.searchUnderWriterById(id);
if(p!=null && p.size()>0) {
rd=request.getRequestDispatcher("searchResult.jsp");
request.setAttribute("PRD", p);
} else {
rd=request.getRequestDispatcher("searchFailure.jsp");
}
}else if("logout".equals(action)) {
HttpSession session=request.getSession();
session.invalidate();
rd=request.getRequestDispatcher("Homepage.jsp");
}else if ("updatesearch".equals(action)) {
int id = Integer.parseInt(request.getParameter("id"));
System.out.println("in search page"+id);
List<UnderWriter> p=controller.searchUnderWriterById(id);
if(p!=null && p.size()>0) {
rd=request.getRequestDispatcher("UpdateUnderwriterpassword.jsp");
request.setAttribute("id", id);
} else {
rd=request.getRequestDispatcher("searchFailure.jsp");
}
}
else if ("insurancesearch".equals(action)) {
int id = Integer.parseInt(request.getParameter("id"));
List<UnderWriter> p=controller.searchUnderWriterById(id);
List<Insurance> ins=controller.searchInsurance(id);
if(ins!=null && ins.size()>0) {
rd=request.getRequestDispatcher("insurancetable.jsp");
request.setAttribute("list",ins);
}
else {
rd=request.getRequestDispatcher("emptymsg.jsp");
request.setAttribute("Id", id);
}
}

	else if ("delete".equals(action)) {
		int id = Integer.parseInt(request.getParameter("id"));
		request.setAttribute("deletedId",id);
		boolean b=controller.delete(id);
		if(b==true) {
			rd=request.getRequestDispatcher("Deletedmsg.jsp");
		} else {
			rd=request.getRequestDispatcher("searchFailure.jsp");
		}
	}
	rd.forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	String action=request.getParameter("action");
	RequestDispatcher rd=null;
	Controller controller=new Controller();
	 if("logout".equals(action)) {
		HttpSession session=request.getSession();
		session.invalidate();
		rd=request.getRequestDispatcher("adminlogin.jsp");
	}
	 else if ("ViewAllUnderWriters".equals(action)) {
		List<UnderWriter> List=controller.viewAllUnderWriter();
		rd=request.getRequestDispatcher("list.jsp");
		request.setAttribute("PLIST", List);
	}else if("register".equals(action)) {
	int id=Integer.parseInt(request.getParameter("id"));
	String name = request.getParameter("name");
	String dob = request.getParameter("dob");
	String doj = request.getParameter("doj");
	String pwd = request.getParameter("psw");
	UnderWriter p=new UnderWriter(id,name, Date.valueOf(dob),Date.valueOf(doj),pwd);
		boolean result=controller.register(p);
		if(result==true) {
			rd=request.getRequestDispatcher("Regsuccess.jsp");
		} else {
			rd=request.getRequestDispatcher("registerFail.jsp");
		}
	

}else if("update".equals(action)) {
int id=Integer.parseInt(request.getParameter("id"));
System.out.println("before update");
String pwd = request.getParameter("pwd");
boolean result=controller.update(id,pwd);
System.out.println("update");
if(result==true) {
rd=request.getRequestDispatcher("Updatesuccess.jsp");
request.setAttribute("updateId",id);
} else {
rd=request.getRequestDispatcher("registerFail.jsp");
}

		}

else if("adminlogin".equals(action)) {
String name =request.getParameter("username");
String pwd=request.getParameter("password");
System.out.println("in uw login page");
if(name.equals("admin")&&pwd.equals("admin123")) {
rd=request.getRequestDispatcher("adminhome.jsp");
} else {
rd=request.getRequestDispatcher("adminlogin.jsp");
}
}
else if("Login".equals(action)) {
int id =Integer.parseInt(request.getParameter("username"));
String pwd=request.getParameter("password");
System.out.println("in uw login page");
Boolean p=controller.searchUnderWriterlogin(id,pwd);
System.out.println("after uw login page");
if(p==true) {
System.out.println("after uw true login page");
rd=request.getRequestDispatcher("underwriterhome.jsp");
} else {
rd=request.getRequestDispatcher("searchFailure.jsp");
}
}
rd.forward(request, response);
}
}

//controller

package com.controller;

import java.util.List;

import com.insurancedao.InsuranceDAO;
import com.insurancemodel.Insurance;
import com.dao.UnderWriterDao;
import com.model.UnderWriter;

public class Controller {
public static List<UnderWriter> viewAllUnderWriter() {
UnderWriterDao Dao = new UnderWriterDao();
return Dao.viewAllUnderWriter();
}

// method to get data from DAO and return it to Web file
public static List<UnderWriter> searchUnderWriter(int id,String name) {
	UnderWriterDao Dao = new UnderWriterDao();
	return Dao.searchUnderWriter(id,name);
}
public static List<UnderWriter> searchUnderWriterById(int id) {
	UnderWriterDao Dao = new UnderWriterDao();
	return Dao.searchUnderWriterById(id);
}

// method to register the product
public static boolean register(UnderWriter p) {
	UnderWriterDao Dao = new UnderWriterDao();
	return Dao.register(p);
}
public static boolean update(int id,String pwd) {
	UnderWriterDao Dao = new UnderWriterDao();
	return Dao.update(id,pwd);
}

// method to delete
public static boolean delete(int id) {
	UnderWriterDao Dao = new UnderWriterDao();
	return Dao.delete(id);

}
// method to get data from DAO and return it to Web file
public static List<Insurance> searchInsurance(int id) {
InsuranceDAO InsuranceDao = new InsuranceDAO();
return InsuranceDao.searchInsurance(id);
}

// method to register the Insurance
public static boolean register(Insurance p) {
	InsuranceDAO InsuranceDao = new InsuranceDAO();
	return InsuranceDao.register(p);
}

public static Insurance searchPolicy(int name)
{
	InsuranceDAO InsuranceDao = new InsuranceDAO();
	return InsuranceDao.searchPolicy(name);
}

public Boolean searchUnderWriterlogin(int id, String pwd) {
	UnderWriterDao Dao = new UnderWriterDao();
	return Dao.searchUnderWriterlogin(id,pwd);
}

}

//Dao

package com.dao;

import java.sql.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.helper.Helper;
import com.model.UnderWriter;

public class UnderWriterDao {
public static List<UnderWriter> viewAllUnderWriter() {
List<UnderWriter> viewResult = new ArrayList<UnderWriter>();
try {
Connection cn = Helper.createConnection();
PreparedStatement ps = cn.prepareStatement("select * from UnderWriter");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int uwid = rs.getInt(1);
String name = rs.getString(2);
Date date_of_birth = rs.getDate(3);
Date date_of_joining = rs.getDate(4);
String defaultpassword=rs.getString(5);
UnderWriter p = new UnderWriter(uwid,name,date_of_birth,date_of_joining,defaultpassword); ;
viewResult.add(p);
}
} catch (SQLException e) {
e.printStackTrace();
}
return viewResult;
}
public List<UnderWriter> searchUnderWriter(int id,String default_password) {
List<UnderWriter> viewResult = new ArrayList<UnderWriter>();
try {
Connection cn = Helper.createConnection();
PreparedStatement ps = cn.prepareStatement("select * from UnderWriter where id=? and default_password=?");
ps.setInt(1,id);
ps.setString(2, default_password);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int uwid = rs.getInt(1);
String name = rs.getString(2);
Date date_of_birth = rs.getDate(3);
Date date_of_joining = rs.getDate(4);
String defaultpassword=rs.getString(5);
UnderWriter uw = new UnderWriter(uwid,name,date_of_birth,date_of_joining,defaultpassword);
viewResult.add(uw);
}
} catch (SQLException e) {
e.printStackTrace();
}
return viewResult;
}
public List<UnderWriter> searchUnderWriterById(int id) {
List<UnderWriter> viewResult = new ArrayList<UnderWriter>();
try {
Connection cn = Helper.createConnection();
PreparedStatement ps = cn.prepareStatement("select * from UnderWriter where id=?");
ps.setInt(1,id);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int uwid = rs.getInt(1);
String name = rs.getString(2);
Date date_of_birth = rs.getDate(3);
Date date_of_joining = rs.getDate(4);
String defaultpassword=rs.getString(5);
UnderWriter uw = new UnderWriter(uwid,name,date_of_birth,date_of_joining,defaultpassword);
viewResult.add(uw);
}
} catch (SQLException e) {
e.printStackTrace();
}
return viewResult;
}
public static boolean register(UnderWriter uw) {
boolean registerResult = false;
try {
Connection cn = Helper.createConnection();
PreparedStatement ps = cn.prepareStatement("insert into UnderWriter values (?,?,?,?,?)");
ps.setInt(1, uw.getId());
ps.setString(2, uw.getName());
ps.setDate(3, uw.getDate_of_birth());
ps.setDate(4, uw.getData_of_joining());
ps.setString(5, uw.getDefault_password());
int number = ps.executeUpdate();
if (number > 0) {
registerResult = true;
}
} catch (SQLException e) {
e.printStackTrace();
}
return registerResult;
}
public static boolean delete(int id) {
boolean deleteResult = false;
try {
Connection cn = Helper.createConnection();
PreparedStatement ps = cn.prepareStatement("delete from UnderWriter where id=?");
ps.setInt(1, id);
int number = ps.executeUpdate();
if (number > 0) {
deleteResult = true;
}
} catch (SQLException e) {
e.printStackTrace();
}
return deleteResult;
}
public boolean update(int id,String pwd) {
boolean updateResult = false;
try {
Connection cn = Helper.createConnection();
PreparedStatement ps = cn.prepareStatement("update UnderWriter set default_password=? where id=?");
ps.setString(1,pwd);
ps.setInt(2,id);
int number = ps.executeUpdate();
if (number > 0) {
updateResult = true;
}
} catch (SQLException e) {
e.printStackTrace();
}
return updateResult;
}
public Boolean searchUnderWriterlogin(int id, String pwd) {
boolean updateResult = false;
try {
Connection cn = Helper.createConnection();
PreparedStatement ps = cn.prepareStatement("select * from UnderWriter where id=? and default_password=?");
ps.setInt(1,id);
ps.setString(2,pwd);
ResultSet rs = ps.executeQuery();
int number=0;
while (rs.next()) {
number++;
}
if (number > 0) {
updateResult = true;
}
} catch (SQLException e) {
e.printStackTrace();
}
return updateResult;
}

}

//Helper

package com.helper;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Helper {
public static Connection createConnection() {
Connection connect=null;
try {
String driver="org.apache.derby.jdbc.EmbeddedDriver";
String databaseURL="jdbc:derby:C:\Users\2561523\UnderWriter;create=true";
Class.forName(driver);
connect=DriverManager.getConnection(databaseURL);
} catch (ClassNotFoundException | SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return connect;

  }
  
public static void closeAllConnection(Connection cn,PreparedStatement ps,ResultSet rs) {
		try {
			if(rs!=null) {
			rs.close();
			}
			if(ps!=null) {
				ps.close();
			}
			if(cn!=null) {
				cn.close();
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
}
}

//model

package com.model;
import java.sql.*;
public class UnderWriter {
private int id;
private String name;
private Date date_of_birth;
private Date data_of_joining;
private String default_password;

public UnderWriter(int id, String name, Date dob, Date doj, String password) {
	super();
	this.id = id;
	this.name = name;
	this.date_of_birth = dob;
	this.data_of_joining = doj;
	this.default_password = password;
}
@Override
public String toString() {
	return "UnderWriter [id=" + id + ", name=" + name + ", date_of_birth=" + date_of_birth + ", data_of_joining="
			+ data_of_joining + ", default_password=" + default_password + "]";
}
public int getId() {
	return id;
}
public void setId(int id) {
	this.id = id;
}
public String getName() {
	return name;
}
public void setName(String name) {
	this.name = name;
}
public Date getDate_of_birth() {
	return date_of_birth;
}
public void setDate_of_birth(Date date_of_birth) {
	this.date_of_birth = date_of_birth;
}
public Date getData_of_joining() {
	return data_of_joining;
}
public void setData_of_joining(Date data_of_joining) {
	this.data_of_joining = data_of_joining;
}
public String getDefault_password() {
	return default_password;
}
public void setDefault_password(String default_password) {
	this.default_password = default_password;
}
 

}
//Insurance model
package com.insurancemodel;

import java.sql.Date;

public class Insurance {
private int PolicyNumber;
private String VehicleNumber;
private String VehicleType;
private String CustomerName;
private int EngineNumber;
private int ChasisNumber;
private int PhoneNumber;
private String InsuranceType;
private int PremiumAmount;
private Date FromDate;
private Date ToDate;
private int UnderwriterId ;

public Insurance(int policyNumber, String vehicleNumber, String vehicleType, String customerName,
		int engineNumber, int chasisNumber, int phoneNumber, String insuranceType, int premiumAmount,
		Date fromDate, Date toDate, int underwriterId)
{
	this.PolicyNumber = policyNumber;
	this.VehicleNumber = vehicleNumber;
	this.VehicleType = vehicleType;
	this.CustomerName = customerName;
	this.EngineNumber = engineNumber;
	this.ChasisNumber = chasisNumber;
	this.PhoneNumber = phoneNumber;
	this.InsuranceType = insuranceType;
	this.PremiumAmount = premiumAmount;
	this.FromDate = fromDate;
	this.ToDate = toDate;
	this.UnderwriterId = underwriterId;
}

@Override
public String toString() {
	return "Insurance [PolicyNumber=" + PolicyNumber + ", VehicleNumber=" + VehicleNumber + ", VehicleType="
			+ VehicleType + ", CustomerName=" + CustomerName + ", EngineNumber=" + EngineNumber + ", ChasisNumber="
			+ ChasisNumber + ", PhoneNumber=" + PhoneNumber + ", InsuranceType=" + InsuranceType
			+ ", PremiumAmount=" + PremiumAmount + ", FromDate=" + FromDate + ", ToDate=" + ToDate
			+ ", UnderwriterId=" + UnderwriterId + "]";
}

public int getPolicyNumber() {
	return PolicyNumber;
}

public void setPolicyNumber(int policyNumber) {
	this.PolicyNumber = policyNumber;
}

public String getVehicleNumber() {
	return VehicleNumber;
}

public void setVehicleNumber(String vehicleNumber) {
	this.VehicleNumber = vehicleNumber;
}

public String getVehicleType() {
	return VehicleType;
}

public void setVehicleType(String vehicleType) {
	this.VehicleType = vehicleType;
}

public String getCustomerName() {
	return CustomerName;
}

public void setCustomerName(String customerName) {
	this.CustomerName = customerName;
}

public int getEngineNumber() {
	return EngineNumber;
}

public void setEngineNumber(int engineNumber) {
	this.EngineNumber = engineNumber;
}

public int getChasisNumber() {
	return ChasisNumber;
}

public void setChasisNumber(int chasisNumber) {
	this.ChasisNumber = chasisNumber;
}

public int getPhoneNumber() {
	return PhoneNumber;
}

public void setPhoneNumber(int phoneNumber) {
	this.PhoneNumber = phoneNumber;
}

public String getInsuranceType() {
	return InsuranceType;
}

public void setInsuranceType(String insuranceType) {
	this.InsuranceType = insuranceType;
}

public int getPremiumAmount() {
	return PremiumAmount;
}

public void setPremiumAmount(int premiumAmount) {
	this.PremiumAmount = premiumAmount;
}

public Date getFromDate() {
	return FromDate;
}

public void setFromDate(Date fromDate) {
	this.FromDate = fromDate;
}

public Date getToDate() {
	return ToDate;
}

public void setToDate(Date toDate) {
	this.ToDate = toDate;
}

public int getUnderwriterId() {
	return UnderwriterId;
}

public void setUnderwriterId(int underwriterId) {
	this.UnderwriterId = underwriterId;
}


}
//Underwriter Helper
package com.insurancehelper;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Helper {
public static Connection createConnection() {
Connection connect=null;
try {
String driver="org.apache.derby.jdbc.EmbeddedDriver";
String databaseURL="jdbc:derby:C:\Users\2561523\Insurancedb;create=true";
Class.forName(driver);
connect=DriverManager.getConnection(databaseURL);
} catch (ClassNotFoundException | SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return connect;

  }
public static void closeAllConnection(Connection cn,PreparedStatement ps,ResultSet rs) {
		try {
			if(rs!=null) {
			rs.close();
			}
			if(ps!=null) {
				ps.close();
			}
			if(cn!=null) {
				cn.close();
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
}
}

//InsuranceDao

package com.insurancedao;

import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.insurancehelper.Helper;
import com.insurancemodel.Insurance;

public class InsuranceDAO {
// method for retiring the data and return the data to controller file
public List<Insurance> viewAllInsurance() {
List<Insurance> viewResult = new ArrayList<Insurance>();
try {
Connection cn = Helper.createConnection();
PreparedStatement ps = cn.prepareStatement("select * from Insurance");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int policyNumber = rs.getInt(1);
String vehicleNumber = rs.getString(2);
String vehicleType = rs.getString(3);
String customerName = rs.getString(4);
int engineNumber = rs.getInt(5);
int chasisNumber = rs.getInt(6);
int phoneNumber = rs.getInt(7);
String insuranceType = rs.getString(8);
int premiumAmount = rs.getInt(9);
Date fromDate = rs.getDate(10);
Date toDate = rs.getDate(11);
int InsuranceId = rs.getInt(12);

			Insurance p = new Insurance(policyNumber, vehicleNumber, vehicleType, customerName,
					engineNumber, chasisNumber, phoneNumber, insuranceType, premiumAmount,
					fromDate, toDate, InsuranceId);
			viewResult.add(p);
		}
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return viewResult;
}

// method for retiring the data and return the data to controller file
public List<Insurance> searchInsurance(int id) {
	List<Insurance> viewResult = new ArrayList<Insurance>();
	try {
		Connection cn = Helper.createConnection();
		PreparedStatement ps = cn.prepareStatement("select * from Insurance where UnderwriterId=?");
		ps.setInt(1,id);
		ResultSet rs = ps.executeQuery();
		while (rs.next()) {
			int policyNumber = rs.getInt(1);
			String vehicleNumber = rs.getString(2);
			String vehicleType = rs.getString(3);
			String customerName = rs.getString(4);
			int engineNumber = rs.getInt(5);
			int chasisNumber = rs.getInt(6);
			int phoneNumber = rs.getInt(7);
			String insuranceType = rs.getString(8);
			int premiumAmount = rs.getInt(9);
			Date fromDate = rs.getDate(10);
			Date toDate = rs.getDate(11);
			int InsuranceId = rs.getInt(12);
			Insurance p = new Insurance(policyNumber, vehicleNumber, vehicleType, customerName,
					engineNumber, chasisNumber, phoneNumber, insuranceType, premiumAmount,
					fromDate, toDate, InsuranceId);
			viewResult.add(p);
		}
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return viewResult;
}

// method to insert the data into DB
public static boolean register(Insurance p) {
	boolean registerResult = false;
	try {
		Connection cn = Helper.createConnection();
		PreparedStatement ps = cn.prepareStatement("insert into Insurance values (?,?,?,?,?,?,?,?,?,?,?,?)");
		ps.setInt(1, p.getPolicyNumber());			
		ps.setString(2, p.getVehicleNumber());
		ps.setString(3, p.getVehicleType());
		ps.setString(4, p.getCustomerName());
		ps.setInt(5, p.getEngineNumber());
		ps.setInt(6, p.getChasisNumber());
		ps.setInt(7, p.getPhoneNumber());
		ps.setString(8, p.getInsuranceType());
		ps.setInt(9, p.getPremiumAmount());
		ps.setDate(10, p.getFromDate());
		ps.setDate(11, p.getToDate());
		ps.setInt(12, p.getUnderwriterId());
		int number = ps.executeUpdate();
		if (number > 0) {
			registerResult = true;
		}
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return registerResult;
}
public static Insurance searchPolicy(int name) {
	
	Insurance searchResult =null;
	try {
		Connection cn = Helper.createConnection();
		PreparedStatement ps = cn.prepareStatement("select * from Insurance where policynumber=?");
		ps.setInt(1, name);
		ResultSet rs = ps.executeQuery();
		while (rs.next()) {
			int policyNumber = rs.getInt(1);
			String vehicleNumber = rs.getString(2);
			String vehicleType = rs.getString(3);
			String customerName = rs.getString(4);
			int engineNumber = rs.getInt(5);
			int chasisNumber = rs.getInt(6);
			int phoneNumber = rs.getInt(7);
			String insuranceType = rs.getString(8);
			int premiumAmount = rs.getInt(9);
			Date fromDate = rs.getDate(10);
			Date toDate = rs.getDate(11);
			int InsuranceId = rs.getInt(12);
			Insurance p = new Insurance(policyNumber, vehicleNumber, vehicleType, customerName,
					engineNumber, chasisNumber, phoneNumber, insuranceType, premiumAmount,
					fromDate, toDate, InsuranceId);
			searchResult = p;
		}
	} catch (SQLException e) {
		e.printStackTrace();
	}
	return searchResult;
}

}

//JSP pages

//searchFailure
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>ProductManagementSystem</title> </head> <body> <jsp:include page="header.jsp"></jsp:include> <h2 align="center">UnderWriterId Search</h2> <table align="center" border="0" align="center" width="40%"> <tr> <td width="40%" align="right"><img src="img/failure.png" width="20" height="20"></td> <td width="60%">Id not existing!!!</td> </tr> </table> <jsp:include page="footer.jsp"></jsp:include> </body> </html>

//registerFail

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>ProductManagementSystem</title> </head> <body> <jsp:include page="header.jsp"></jsp:include> <h2 align="center">UnderWriter Registration</h2> <table align="center" border="0" align="center" width="40%"> <tr> <td width="40%" align="right"><img src="img/failure.png" width="20" height="20"></td> <td width="60%">UnderWriter registration failed!!!</td> </tr> </table> <jsp:include page="footer.jsp"></jsp:include> </body> </html>

//list.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="com.model.UnderWriter" %>
<%@ page import="java.util.*" %>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>UnderWriterManagementSystem</title> </head> <link rel="stylesheet" href="css/mystyle.css"> <body> <jsp:include page="header.jsp"></jsp:include> <h2 align="center">UnderWriter List</h2> <% List<UnderWriter> prList=(List<UnderWriter>)request.getAttribute("PLIST"); %> <table border="1" align="center" width="80%" id="UnderWriters"> <tr> <th width="15%">UnderWriter Id</th><th width="15%">Name</th><th width="15%">Date_of_birth</th><th width="15%">Date_of_Joining</th><th width="15%">Default_password</th> </tr> <% for(UnderWriter p:prList) { %> <tr> <td><%=p.getId() %></td> <td><%=p.getName() %></td> <td><%=p.getDate_of_birth() %></td> <td><%=p.getData_of_joining()%></td> <td><%=p.getDefault_password() %></td> </tr> <% } %> </table> <jsp:include page="footer.jsp"></jsp:include> </body> </html>

//Regsuccess
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>ProductManagementSystem</title> </head> <body> <jsp:include page="header.jsp"></jsp:include> <h2 align="center">UnderWriter Registration</h2> <table align="center" border="0" align="center" width="40%"> <tr> <td width="40%" align="right"><img src="img/failure.png" width="20" height="20"></td> <td width="60%">UnderWriter registration success!!!</td> </tr> </table> <jsp:include page="footer.jsp"></jsp:include> </body> </html>

//searchResult
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="com.model.UnderWriter" %>
<%@ page import="java.util.List" %>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>UnderWriterManagementSystem</title> </head> <link rel="stylesheet" href="css/mystyle.css"> <body> <jsp:include page="header.jsp"></jsp:include> <h2 align="center">UnderWriter Search Result</h2> <% List<UnderWriter> prList=(List<UnderWriter>)request.getAttribute("PRD"); %> <table border="1" align="center" width="80%" id="UnderWriters"> <tr> <th width="15%">UnderWriter Id</th><th width="30%">Name</th><th width="15%">DOB</th><th width="15%">DOJ</th><th width="15%">Default_password</th> </tr> <% for(UnderWriter p:prList) { %> <tr> <td><%=p.getId() %></td> <td><%=p.getName() %></td> <td><%=p.getDate_of_birth() %></td> <td><%=p.getData_of_joining()%></td> <td><%=p.getDefault_password() %></td> </tr> <% } %> </table> <jsp:include page="footer.jsp"></jsp:include> </body> </html>

//searchUnderWriterById
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>SearchUnderwriterById</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
</style>

</head> <body> <form action="UnderWriterServlet" method="get"> <div class="container"> <h1>Underwriter Search:</h1> <label>Underwriter ID</label> <input type="text" name="id" placeholder="Enter id" required><br> <input type="submit" name="action" value="SearchById"> </form> <jsp:include page="footer.jsp"></jsp:include> </div> </body> </html>

//UD Homepage
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Admin Home page</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
.dropdown .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
}

.navbar a:hover, .dropdown:hover .dropbtn {
background-color: red;
}

.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}

.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}

.dropdown-content a:hover {
background-color: #ddd;
}

.dropdown:hover .dropdown-content {
display: block;
}
</style>

</head> <body> <jsp:include page="header.jsp"></jsp:include> <div class="container"> <h1 >Admin Home page</h1> <div class="dropdown"> <button class="dropbtn">Dropdown <i class="fa fa-caret-down"></i> </button> <div class="dropdown-content"> <a href="InsuranceRegistration.jsp">Create a new Vehicle Insurance</a> <a href="InsuranceRenew.jsp">Renewal Your Policy</a> <a href="#">Change Your policy</a> <a href="#">View Your Policy </a> </div> <jsp:include page="footer.jsp"></jsp:include> </body> </html>

//UD login
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Underwriter Login</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
</style>

</head> <body> <div class="container"> <form action="UnderWriterServlet" method="post"> <h1>Underwriter login</h1> <label for="username">UnderWriter Id:<strong>*</strong></label> <input type="text" id="username" name="username" placeholder="Enter underwritername" required> <label for="password">Password:<strong>*</strong></label> <input type="password" id="password" name="password" placeholder="Enter password" required> <input type="submit"id="login-btn" name="action" value="Login"> </form> </div> </body> </html>

//UDREG
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="java.util." %>
<%@page import="java.time.
" %>
<%@page import="java.text.*" %>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>UnderWriter Registration</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
align-items: center;
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
</style>

</head> <body> <div> <form action="UnderWriterServlet" method="post"> <h1>UnderWriter Registration</h1> <label >Underwriter ID:<strong>*</strong></label> <% Random rand = new Random(); int n = rand.nextInt(90000) + 10000; %> <input type="text" name="id" value="<%=n %>" ><br><br> <label>Name:<strong>*</strong></label> <input type="text" id="name" name="name" placeholder="Enter Name" required><br><br> <label >Date of Birth:<strong>*</strong></label> <input type="date" id="dob" name="dob" required><br><br> <label >Joining Date:<strong>*</strong></label> <% LocalDate date = LocalDate.now(); String s=date.toString();

%>
<input type="text" name="doj" value="<%=s %>">
<br><label>Default Password:<strong>*</strong></label>
<input type="password" id="psw" name="psw" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters" required>

<input style="margin-left:100px" type="submit" name="action" value="register"> <jsp:include page="footer.jsp"></jsp:include> </form> </div> </body> </html>

//Update
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>SreachUnderwriter</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
</style>

</head> <body> <form action="UnderWriterServlet" method="get"> <div class="container"> <h1>Underwriter Search:</h1> <label>Underwriter ID</label> <input type="text" name="id" placeholder="Enter id" required><br> <input type="submit" name="action" value="updatesearch"> </form> <jsp:include page="footer.jsp"></jsp:include> </div> </body> </html>

//Update success
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>ProductManagementSystem</title> </head> <body> <jsp:include page="header.jsp"></jsp:include> <h2 align="center">UnderWriter Registration</h2> <table align="center" border="0" align="center" width="40%"> <tr> <td width="40%" align="right"><img src="img/failure.png" width="20" height="20"></td> <td width="60%">UnderWriter with id:<%=request.getAttribute("updateId") %> Password is successfully Updated!!!</td> </tr> </table> <jsp:include page="footer.jsp"></jsp:include> </body> </html>

//UpdateUnderwriterpassword

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Insert title here</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
</style>

</head> <body> </body> <body> <form action="UnderWriterServlet" method="post"> <div class="container"> <h1>Update Underwriter Password</h1> <hr> <label>UnderWriter Id:</label> <input type="text" name="id" value=<%=request.getAttribute("id") %> readonly> <label>New password:</label> <input type="password" id="old" name="pwd" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters" required> <label>confirm password:</label> <input type="password" id="new" name="newpwd" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters" required> <input type="submit" name="action" onClick="fun()" value="update"> <jsp:include page="footer.jsp"></jsp:include> </div> </form> <script type="text/javascript"> function fun(){ if(document.getElementById("new").value != document.getElementById("old").value){ alert("new Password and confirm password are not matching"); windows.location("UpdateUnderwriterpassword.jsp"); } } </script> </body> </html>

//Admin footer
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Star Protect Vehicle</title> </head> <body> <hr> <h5 align="center">&copy; All rights reserved to TCS 2024-2025.</h5> </body> </html>

//Admin Homepage

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Admin Home page</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
.dropdown .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
}

.navbar a:hover, .dropdown:hover .dropbtn {
background-color: red;
}

.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}

.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}

.dropdown-content a:hover {
background-color: #ddd;
}

.dropdown:hover .dropdown-content {
display: block;
}
</style>

</head> <body> <div class="container"> <h1 >Admin Home page</h1> <div class="dropdown"> <button class="dropbtn">Dropdown <i class="fa fa-caret-down"></i> </button> <div class="dropdown-content"> <a href="UnderWriterRegistration.jsp">UnderWriterRegistration</a> <a href="searchunderwriterId.jsp">Search underwriter by Id</a> <a href="update.jsp">Update Underwriter password</a> <a href="Deleteunderwriter.jsp">Delete Underwriter ID</a> <a href="viewAllUnderwriter.jsp">view All Underwriter</a> <a href="#">view All vehicles specific by ID</a> </div> <jsp:include page="adminfooter.jsp"></jsp:include> </body> </html>

//viewAllUnderwriter
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>View All Underwriter</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
.dropdown .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
}

.navbar a:hover, .dropdown:hover .dropbtn {
background-color: red;
}

.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}

.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}

.dropdown-content a:hover {
background-color: #ddd;
}

.dropdown:hover .dropdown-content {
display: block;
}
</style>

</head> <body> <div class="container"> <h1>View all Underwriter Data</h1> <hr> <p>Click on show all to see all underwriters details</p> <form action="UnderWriterServlet?action=ViewAllUnderWriters" method="post"> <input type="submit" name="action" value="ViewAllUnderWriters"> </form> <jsp:include page="footer.jsp"></jsp:include> </div> </body> </html>

//Deletedmsg
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>ProductManagementSystem</title> </head> <body> <jsp:include page="header.jsp"></jsp:include> <h2 align="center">UnderWriter Registration</h2> <table align="center" border="0" align="center" width="40%"> <tr> <td width="40%" align="right"><img src="img/failure.png" width="20" height="20"></td> <td width="60%">UnderWriter with Id:<%=request.getAttribute("deletedId") %>!!!</td> </tr> </table> <jsp:include page="footer.jsp"></jsp:include> </body> </html>

//adminlogin
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Admin Login</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
</style>

</head> <body> <div class="container"> <h1>Admin login</h1> <form action="UnderWriterServlet" method="post"> <label >Admin Name:<strong>*</strong></label> <input type="text" id="idName" name="username" placeholder="Enter adminname" required> <label >Password:<strong>*</strong></label> <input type="password" id="idPswd" name="password" placeholder="Enter password" required> <button type="submit"id="login-btn" name="action" value="adminlogin" onClick="onLogin()">Login</button> <jsp:include page="adminfooter.jsp"></jsp:include> </form> </div> <!-- <script> function onLogin() { var username = document.getElementById("idName").value; var password = document.getElementById("idPswd").value; if(username != "admin" && password != "admin123"){ alert("Invalid creditionals"); } }

</script>-->

</body> </html>

//emptymsg

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>ProductManagementSystem</title> </head> <body> <jsp:include page="header.jsp"></jsp:include> <h2 align="center">UnderWriter Registration</h2> <table align="center" border="0" align="center" width="40%"> <tr> <td width="40%" align="right"><img src="img/failure.png" width="20" height="20"></td> <td width="60%">No vehicle is insuranced by the UnderWriter with Id:<%=request.getAttribute("Id") %>!!!</td> </tr> </table> <jsp:include page="footer.jsp"></jsp:include> </body> </html>

//Deleteunderwriter
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Insert title here</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
</style>

</head> <body> <div class="container"> <h1>Delete underwriter</h1> <form action="UnderWriterServlet" method="get"> <label>Underwriter ID</label> <input type="text" name="id" placeholder="Enter id" required><br> <input type="submit" name="action" value="delete"> </form> <jsp:include page="footer.jsp"></jsp:include> </div> </body> </html>

//footer

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Product Management System</title> <style> .footer-container { position: fixed; bottom: 10px; width: 100%; height: 2.5rem; background-color: #382638; /* Changed background color to purple */ color: white; /* Changed text color to white for better contrast */ } .footer-content { display: flex; justify-content: space-between; align-items: center; padding: 0 1rem; } .footer-content img { height: 100%; } .footer-content h5 { margin: 0; } </style> </head> <body> <div class="footer-container"> <div class="footer-content"> <img alt="TCS_Logo" src="Images/TCS_Gradient_White_2021.svg" align="left"> <h5 align="right">&copy; All rights reserved to TCS 2024-2025.</h5> </div> <p align="center"><a href="home.jsp">Back</a></p> </div> </body> </html>

//Homepage

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body { margin: 0; font-family: Arial, Helvetica, sans-serif; }

.topnav {
overflow: hidden;
background-color: #333;
position: fixed; /* Make the navigation bar fixed at the top /
top: 0;
left: 0;
width: 100%;
z-index: 1000; /
Ensure it stays on top of other content */
}

.topnav a {
float: left;
display: block; /* Change from flex to block for anchor tags */
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}

.topnav a:hover {
background-color: #ddd;
color: black;
}

.topnav a.active {
background-color: #04AA6D;
color: white;
}
/* body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
} */
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
margin-top:100px;
margin-left:600px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
</style>
<meta charset="ISO-8859-1">

<title>Star protect Vechile</title> </head> <body> <jsp:include page="header.jsp"></jsp:include> <div style="padding-left:16px"> <div class="container"> <h1 >Star protect Vechile</h1> <a href="adminlogin.jsp"><button type="submit"id="login-btn">Admin Login</button></a> <a href="underwriterlogin.jsp"><button type="submit"id="login-btn">UnderWriter Login</button></a> </div> </body> <jsp:include page="footer.jsp"></jsp:include> </html>

//Header.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html> <html> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <style> body {font-family: Arial, Helvetica, sans-serif; margin:0;}

.navbar {
width: 100%;
background-color: #555;
overflow: auto;
}

.navbar a {
float: left;
padding: 12px;
color: white;
text-decoration: none;
font-size: 17px;
}

.navbar a:hover {
background-color: #000;
}

.navbar2 a {
float: right;
padding: 12px;
color: white;
text-decoration: none;
font-size: 17px;
}

.navbar2 a:hover {
background-color: #000;
}

.active {
background-color: #04AA6D;
}

@media screen and (max-width: 500px) {
.navbar a {
float: none;
display: block;
}
}
h2{
color:#573d73;
}
</style>

<head> <meta charset="ISO-8859-1"> <title>StarProtectVehicleInsurance</title> </head> <body> <% String name=(String)session.getAttribute("NAME"); %> <%if(name!=null){ %> <h4 align="right">Welcome <%=name %> <a href="ProductServlet?action=logout">Logout</a></h4> <%} %> <div class="navbar"> <a class="active" href="index.jsp"><i class="fa fa-fw fa-home"></i> Home</a> <div class="navbar2"> <a href="adminLogin.jsp"><i class="fa fa-fw fa-user"></i> Admin Login</a> <a href="uwlogin.jsp"><i class="fa fa-fw fa-user"></i> UnderWriter Login</a> </div> </div> <h2 align="center">Star Protect Vehicle Insurance</h2> </body> </html>

//index.jss

body{
background-color:#f4f4f4;
color:#555;
font-family:Arial, Helvetica, sans-serif;
text-align: center;
}
.headerh2
{margin :auto ;}
form
{display: inline-block;}
.required:after {
content:" *";
color: red;
}
body{
color:#0e25dd;
font-family:Arial, Helvetica, sans-serif;
border: 1px solid black;
margin :100px 100px 100px 100px;
}
.reg-form
{ margin :100px 100px 100px 100px;
}
.mainpage
{ background-color : #F0E68C;
}
input[type=text]{
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 4px 40px;
}
input[type=password]{
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 4px 40px;
}
input[type=date]{
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 4px 40px;
}
input[type=VType]{
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 120px 4px 40px;
}
input[type=tel]{
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 4px 40px;
}
input[type=Ptype]{
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 4px 40px;
}
input[type=number]{
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 4px 40px;
}

#VType{
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 120px 4px 40px;
}
#PType{
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 120px 4px 40px;
}

/-------------------------------------------Main Admin Buttons---------------------------------------------------/
.change-button {
border-radius: 4px;
background-color: #f4511e;
border: none;
color: #FFFFFF;
text-align: center;
font-size: 28px;
padding: 20px;
width: 200px;
transition: all 0.5s;
cursor: pointer;
margin: 5px;
}

form
{
text-align: center;
}

.change-button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}

.change-button span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}

.change-button:hover span {
padding-right: 25px;
}

.change-button:hover span:after {
opacity: 1;
right: 0;
}

/---------------------------------------------------New Insurance---------------------------------------------------/
.NewIn
{
border :5px outset;
text-align:center;
background-color: #d9ffcc;
padding-bottom: 30px;
}
button {
background-color: #4caf50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
}
.button
{
background-color: #4caf50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
}

button:hover {
background-color: #45a049;
}

//Insurance reg

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="java.util." %>
<%@page import="java.time.
" %>
<%@page import="java.text.*" %>

<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>UnderWriter Registration</title> <style> body {

font-family: Arial;

display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
h1{
text-align: center;
color: darkolivegreen;
}
.container {
background:burlywood;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.container h2 {
margin-bottom: 20px;
}
.container select,
.container input[type="text"],
.container input[type="password"],
.container input[type="number"],
.container input[type="tel"],
.container input[type="date"],
.container button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
align-items: center;
background-color: #025516;
color: white;
border: none;
cursor: pointer;
}
form {
max-width: 500px;
margin: 0 auto;
background-color:burlywood;
padding: 50px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
strong{
color:red;
}
</style>

<script> function autofillInput() { var dropdown = document.getElementById("VType"); var selectedValue = dropdown.options[dropdown.selectedIndex].value; var inputBox = document.getElementById("inputBox"); // Logic to autofill the input box based on selected value if (selectedValue === "2-Wheeler") { inputBox.value = "3500"; } else if (selectedValue === "4-Wheeler") { inputBox.value = "28000"; } else { inputBox.value = ""; // Default or empty value } } </script>
<title>New Insurance Registration</title>
</head> <body> <div> <form action="InsuranceServlet" method="post"> <h2> Create New Insurance </h2> <table> <tr> <td> <label for="policynumber">Enter Policy Number</label></td> <%Random rand = new Random(); int pid = rand.nextInt(90000) + 10000; %> <td> <input type="number" id="pid" name ="policynumber" value="<%=pid %>" readonly></td> </tr> <tr> <td><label for="Vehi-No">Enter Vehicle Number</label> </td> <td><input type="text" id="Vehi-No" maxlength="10" name ="vehiclenumber" required> </td> </tr> <tr> <td><label for="VType">Select the Vehicle Type</label> </td> <td> <select id="VType" name="dropdown" onchange="autofillInput()"> <option value="">Select...</option> <option value="2-Wheeler" >2-Wheeler</option> <option value="4-Wheeler" >4-Wheeler</option> </select> </td> </tr> <tr> <td><label for="CNum" >Enter Customer Name</label> </td> <td><input type="text" id="CNum" maxlength="50" name="customername" required> </td> </tr> <tr> <td><label for="EnNum">Enter Engine Number</label> </td> <td> <input type="text" id="EnNum" name="enginenumber" required> </td> </tr> <tr> <td> <label for="ChasisNum">Enter Chasis Number </label> </td> <td><input type="number" id="ChasisNum" name="chasisnumber" required> </td> </tr> <tr> <td><label for="PhoneNum">Enter Phone number</label> </td> <td><input type="tel" id="PhoneNum" maxlength="10" name="phonenumber" required> </td> </tr> <tr> <td><label for="Premiumamount">Enter Premium Amount</label> </td> <td><input type="text" id="inputBox" name="premiumamount" readonly> </td> </tr> <tr> <td><label for="PType">Select the Insurance Type :</label> </td> <td><select name="insurancetype" id="PType"> <option value="Full_Insurance" >Full Insurance</option> <option value="Third_Party" >Third Party</option> </select> </td> </tr> <tr> <td><label for="FromDate">Select the Starting Date</label> </td> <td><input type="date" id="FromDate" name="fromdate" required> </td> </tr> <tr> <td><label for="ToDate">Select the Ending Date</label> </td> <td><input type="date" id="ToDate" name="todate" required> </td> </tr> <tr> <td><label for="UW">Enter UnderWrited ID</label> </td> <td><input type="text" id="UW" name="uwid" required> </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="action" value="register"></td> </tr>
    <br><br>
</table> 
</form>
</div> </body> </html>

//Insurance table

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="com.insurancemodel.Insurance" %>
<%@ page import="java.util.List" %>

<!DOCTYPE html> <html> <head> <style> input[type=button], input[type=submit], input[type=reset] { background-color: red; border: none; color: white; padding: 16px 32px; text-decoration: none; margin: 4px 2px; cursor: pointer; } </style> <meta charset="ISO-8859-1"> <title>ProductManagementSystem</title> </head> <link rel="stylesheet" href="css/mystyle.css"> <body> <jsp:include page="header.jsp"></jsp:include> <h2 align="center">Insurance Search Result</h2> <% List<Insurance> List=(List<Insurance>)request.getAttribute("list"); %> <table border="1" align="center" width="80%" id="products"> <tr> <th width="15%">Policy Number</th><th width="30%">Vehicle Number</th><th width="15%">VehicleType</th><th width="15%">Customer Name</th><th width="15%">Engine Number</th><th width="15%">Chasis Number</th><th width="15%">Phone Number</th><th width="15%">Insurance Type</th><th width="15%">Premium Amount</th><th width="15%">FromDate</th><th width="15%">ToDate</th><th width="15%">UnderwriterId</th><th width="15%">Insurance Claim Status</th> </tr> <% for(Insurance I:List) { %> <tr> <td><%=I.getPolicyNumber() %></td> <td><%=I.getVehicleNumber() %></td> <td><%=I.getVehicleType() %></td> <td><%=I.getCustomerName() %></td> <td><%=I.getEngineNumber() %></td> <td><%=I.getChasisNumber() %></td> <td><%=I.getPhoneNumber() %></td> <td><%=I.getInsuranceType() %></td> <td><%=I.getPremiumAmount() %></td> <td><%=I.getFromDate() %></td> <td><%=I.getToDate() %></td> <td><%=I.getUnderwriterId() %></td>
	</tr>
<%
	}
%>
</table> <br> <br> <jsp:include page="footer.jsp"></jsp:include> </body> </html>