Aryan Chopda Weekly Diary
Aryan Chopda Weekly Diary
EnrollmentNo:
Name of Polytechnic:
Specialinstructionstostudents:
2. Introduction to HTML.
6. Assignment1
1.To make Home page,Registration page,Login Page and link them.
Signature of Student:
Expected Work: Study of Production processes in the industry.
Mentor Assignment
1) List production processes along with production planning and control
procedures.
Students should write in brief about assignment in weekly diary and write in detail and
submit it to the mentor in soft copy as Assignment No.2.
Signature of Student:
Expected Work:Study of layout and specifications of major
machines.
Mentor Assignment
i) Study of layout and specifications of major machines,equipment and raw material/
components used
Students should write in brief about assignment in weekly diary and write in detail and
submit it to the mentor in soft copy as Assignment No.3.
Signature of Student:
Expected Work : Testing processes in the industry.
Mentor Assignment:
Students should write in brief about assignment in weekly diary and write in detail
and
Submit it to the mentor in soft copy as Assignment No.4.
Signature of Student:
Expected Work : maintenance procedures in the industry.
Mentor Assignment:
The major mac jines/plants whose preventive eand breakdown maintenance procedures
studied.
Student should write in brief about assignment in weekly dairy and write in detail and
submit it to the mentor in soft copy as assignment No.5
Signature of Student:
IN PLANT TRAINING WEEKLY DIARY
Week6:From
Expected Work:i)List the major manuals/broachers such as operational manual,
safety manual, maintenance manual, quality manuals referred/studied there for
preparation of reports.
Mentor Assignment:
Students should write in brief about assignment in weekly diary and write in detail and
submit it to the mentor in soft copy as Assignment No.6.
Day Activities carried out
a) Homepage.jsp
<%@pagelanguage="java"contentType="text/html;charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=ISO-8859-1">
<title>Homepage</title>
</head>
<body>
<divalign="center">
<h1>WelcometoHomepage</h1>
<hr/>
<br/><ahref="Registration.jsp">GotoRegestrationpage</a><br/>
<br/><ahref="login.jsp">GotoLoginpage</a>
</div>
</body>
</html>
b) Registration.jsp
<%@pagelanguage="java"contentType="text/html;charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=ISO-8859-1">
<title>Registration</title>
</head>
<body>
<divalign="center">
<h1>WelcometoRegistrationpage</h1>
<hr/>
<br/><ahref="login.jsp">GotoLoginpage</a><br/><br/>
<ahref="Homepage.jsp">GotoHomepage</a></div>
</body>
</html>
c) LoginPage.html
<%@pagelanguage="java"contentType="text/html;charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=ISO-8859-1">
<title>Registration</title>
</head>
<body>
<divalign="center">
<h1>WelcometoRegistrationpage</h1>
<hr/>
<br/><ahref="login.jsp">GotoLoginpage</a><br/><br/>
<ahref="Homepage.jsp">GotoHomepage</a>
</div>
</body>
</html>
*OUTPUT
Assignment2
To create a Student registration form for exam.
<%@pagelanguage="java"contentType="text/html;charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=ISO-8859-1">
<title>Registration</title>
</head>
<body>
<divalign="center">
<h1>WelcometoRegistrationpage</h1>
<hr/>
<br/>
<Formaction="registration"method="post">
<table>
<tr>
<td>Name</td>
<td><inputtype="text"name="full_name"></td>
</tr>
<tr>
<td>Address</td>
<td><textarearows=4cols=10name="address"></textarea></td>
</tr>
<tr>
<td>Age</td>
<td><inputtype="number"name="age"></td>
</tr>
<tr>
<td>Mobileno</td>
<td><inputtype="number"name="mobileno"></td>
</tr>
<tr>
<td>DateofBirth</td>
<td><inputtype="date"name="DOB"></td>
</tr>
<tr>
<td>Gender</td>
<td><inputtype="radio"name="gender"checked="checked">Male<input
type="radio" name="gender">Female</td>
</tr>
<tr>
<td>Category</td>
<td><selectname="category">
<option>sc</option>
<option>open</option>
<option>St</option>
<option>nt</option>
</select></td>
</tr>
<tr>
<td>Password</td>
<td><inputtype="password"name="password"></td>
<tr>
<tdalign="center"><inputtype="submit"value="registration"><input type="Reset"
name="clear data"></td>
</tr>
</table>
</Form>
<hr/>
</div>
</body>
</html>
*OUTPUT
Assignment3
import java.io.IOException;
import java.sql.Connection;
importjava.sql.DriverManager;
importjava.sql.PreparedStatement;
importjavax.servlet.ServletConfig;
import javax.servlet.ServletException;
importjavax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
/**
*ServletimplementationclassRegistration
*/
@WebServlet("/Registration")
publicclassRegistrationextendsHttpServlet{
privatestaticfinallongserialVersionUID=1L;
publicvoidinit(ServletConfigconfig)throwsServletException{
/**
*@seeHttpServlet#doGet(HttpServletRequestrequest,HttpServletResponse
response)
*/
protectedvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{ System.ou
t.println("Do get Execute");
protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)
throws ServletException, IOException
{ System.out.println("DoPostmethodExecute");
Stringfullname=request.getParameter("full_name");
String address=request.getParameter("address");
String dob = request.getParameter("dob");
StringGender=request.getParameter("Gender");
String mobil= request.getParameter("mobil");
String email= request.getParameter("email");
Stringpassword=request.getParameter("password");
Connectioncon=null;
try
{
Class.forName("com.mysql.jdbc.Driver");
con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/collage_diploma","r oot","");
System.out.println("ConnectionDone");
}
catch(Exceptione)
{
System.out.println("Exceptionoccurs..!");
}
try{
PreparedStatementps=con.prepareStatement("INSERTINTO
`user_detail`(`fullname`,`address`,`dob`,`Gender`,`mobil`,`email`,`password`) VALUES
('"+fullname+"','"+address+"','"+dob+"','"+Gender+"','"+mobil+"','"+email+"','"+pass
word+"')");
inti=ps.executeUpdate();
System.out.println("i="+i);
if(i>0)
{
System.out.println("Data insert Done "); response.sendRedirect("registration.jsp?
reg=done");
}
else
{
System.out.println("Data Not inserted..!");
response.sendRedirect("first.jsp?reg=fail");
}
}catch(Exceptione)
{
System.out.println("Excpetion"+e);
}
// syso=cntr+spacebar--------System.out.println();
}
*OUTPUT
Assignment4
1).to retrieve information from database and display it.
<%@pageimport="java.sql.Connection"%>
<%@pageimport="java.sql.ResultSet"%>
<%@pageimport="java.sql.PreparedStatement"%>
<%@pageimport="com.conn.Databaseconnection"%>
<%@pagelanguage="java"contentType="text/html;charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=ISO-8859-1">
<title>RetriveInformation</title>
</head>
<body>
<divalign="center">
<h1>Retriveddata</h1>
<hr/>
<table>
<tr>
<th>Id</th>
<th>Full_name</th>
<th>Address</th>
<th>DOB</th>
<th>Gender</th>
<th>Mobil_no</th>
<th>Email_id</th>
<th>password</th>
<th>Operation</th>
</tr>
<%
Connectioncon=Databaseconnection.getConnection();
PreparedStatement ps = con
.prepareStatement("select*fromuser_detail");
ResultSet rs = ps.executeQuery();
while(rs.next()){
Stringid=rs.getString("id");
%>
<tr>
<td><%=rs.getString("id")%></td>
<td><%=rs.getString("fullname")%></td>
<td><%=rs.getString("address")%></td>
<td><%=rs.getString("dob")%></td>
<td><%=rs.getString("Gender")%></td>
<td><%=rs.getString("mobil")%></td>
<td><%=rs.getString("email")%></td>
<td><%=rs.getString("password")%></td>
<td><ahref="DeleteUser?id=<%=id%>">Delete</a></td>
<td><ahref="UpdateRecord.jsp?id=<%=id%>">Update</a></td>
</tr>
<%
System.out.println("Dataisavailable");
}
%>
</table>
</div>
</body>
</html>
*OUTPUT
<%@pagelanguage="java"contentType="text/html;charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=ISO-8859-1">
<title>Updaterecord</title>
</head>
<body>
<divalign="center">
<h1>Updaterecord</h1>
<hr>
<br>
<formaction="Registration"method="post">
<tableborder=0>
<tr>
<td>Name</td>
<td><inputtype="text"Name="full_name"></td>
</tr>
<tr>
<td>address</td>
<td><textarearows="2"cols="10"name="address"></textarea>
<tr>
<td>Dathofbirth</td>
<td><inputtype="date"Name="dob"></td>
</tr>
<tr>
<td>Gender</td>
<td><inputtype="radio"name="Gender"value="Male">Male<input
type="radio" name="Gender" value="Female">female</td>
</tr>
<tr>
<td>Mobilenumber</td>
<td><inputtype="text"placeholder="mobile"Name="mobil"></td>
</tr>
<tr>
<td>EmailId</td>
<td><inputtype="text"Name="email"></td>
</tr>
<tr>
<td>Password</td>
<td><inputType="password"Name="password"></td>
</tr>
<tr>
<td></td>
<td><inputtype="submit"value="Update"><input
type="reset" value="clear"></td>
</tr>
</table>
</form>
<ahref=userRecord.jsp>userrecord</a>
</div>
</body>
</html>
b) UpdateRecord.java
package com.code;
importjava.io.IOException;
importjava.sql.Connection;
importjava.sql.PreparedStatement;
importjavax.servlet.ServletConfig;
import javax.servlet.ServletException;
importjavax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
importcom.conn.Databaseconnection;
/**
*ServletimplementationclassUpdateRecord
*/
@WebServlet("/UpdateRecord")
publicclassUpdateRecordextendsHttpServlet{
staticConnectioncon=null;
publicvoidinit(ServletConfigconfig)throwsServletException{
try{
con=Databaseconnection.getConnection();
} catch (Exception e)
{ System.out.println("Exc"+e);
}
}
Stringid=request.getParameter("id");
Stringf_name=request.getParameter("full_name");
Stringaddress=request.getParameter("address");
String dob = request.getParameter("dob");
String gender = request.getParameter("gender");
Stringmobile=request.getParameter("mobilno");
String email = request.getParameter("email");
Stringpasswor=request.getParameter("password");
try{
PreparedStatementps=con
.prepareStatement("UPDATE`user_detail`SET`fullname`='"
+f_name+"',`address`='"+address+"',`dob`='"
+dob+"',`gender`='"+gender+"',`mobile`='"
+mobile+"',`password`='"+passwor
+"'WHERE`id`='"+id+"'");
intr=ps.executeUpdate();
if(r>0){
System.out.println("All Information Updated...!");
response.sendRedirect("userRecord.jsp?update=done");
}else{
System.out.println("Update Operation Fail...!"); response.sendRedirect("userRecord.jsp?
fail=update");
}
} catch (Exception e)
{ System.out.println("Exc"+e);
}
}
}
C).DeleteUser.java
package com.code;
importjava.io.IOException;
importjava.sql.Connection;
importjava.sql.PreparedStatement;
importjava.sql.SQLException;
importjavax.servlet.ServletConfig;
import javax.servlet.ServletException;
importjavax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
importcom.conn.Databaseconnection;
/**
*ServletimplementationclassDeleteUser
*/
@WebServlet("/DeleteUser")
publicclassDeleteUserextendsHttpServlet {
privatestaticfinallongserialVersionUID=1L;
/**
*@seeServlet#init(ServletConfig)
*/
publicvoidinit(ServletConfigconfig)throwsServletException{
//TODOAuto-generatedmethodstub
}
/**
*@seeHttpServlet#doGet(HttpServletRequestrequest,HttpServletResponse
response)
*/
protectedvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException
{
String id=request.getParameter("id");
Connectioncon=Databaseconnection.getConnection();
try
{
PreparedStatementps=con.prepareStatement("DELETEFROM`user_detail`WHERE
id='"+id+"'");
inti=ps.executeUpdate();
if(i>0)
{
System.out.println("Delete Done"+id); response.sendRedirect("userRecord.jsp?
delete=done");
}
else
{
System.out.println("Delete Fail...!");
response.sendRedirect("userRecord.jsp?fail=delete");
}
}catch(Exceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}
}
*OUTPUT
Assignment5
Index.jsp
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="utf-8"/>
<metaname="viewport"
content="width=device-width,initial-scale=1,shrink-to-fit=no"/>
<metaname="description"content=""/>
<metaname="author"content=""/>
<title>Employee</title>
<!--Favicon-->
<linkrel="icon"type="image/x-icon"href="assets/favicon.ico"/>
<!--FontAwesomeicons(freeversion)-->
<scriptsrc="https://use.fontawesome.com/releases/v5.15.4/js/all.js"
crossorigin="anonymous"></script>
<!--Googlefonts-->
<linkhref="https://fonts.googleapis.com/css?family=Montserrat:400,700"
rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css?
family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css" />
<!--CorethemeCSS(includesBootstrap)-->
<linkhref="css/index-styles.css"rel="stylesheet"/>
</head>
<bodyid="page-top">
<!--Navigation-->
<nav
class="navbarnavbar-expand-lgbg-secondarytext-uppercasefixed-top"
id="mainNav">
<divclass="container">
<aclass="navbar-brand"href="#page-top">Employee</a>
<button
class="navbar-togglertext-uppercasefont-weight-boldbg-primarytext-white rounded"
type="button"data-bs-toggle="collapse"
data-bs-target="#navbarResponsive"aria-controls="navbarResponsive"
aria-expanded="false" aria-label="Toggle navigation">
Menu<iclass="fasfa-bars"></i>
</button>
<divclass="collapsenavbar-collapse"id="navbarResponsive">
<ulclass="navbar-navms-auto">
<liclass="nav-itemmx-0mx-lg-1"><a
class="nav-linkpy-3px-0px-lg-3rounded"href="registration.jsp">Register</a></li>
<liclass="nav-itemmx-0mx-lg-1"><a
class="nav-linkpy-3px-0px-lg-3rounded"href="Details.jsp">ViewEmployee detail</a></li>
<liclass="nav-itemmx-0mx-lg-1"><a
class="nav-linkpy-3px-0px-lg-3rounded"href="index.jsp">Home</a></li>
</ul>
</div>
</div>
</nav>
<!--Masthead-->
<headerclass="mastheadbg-primarytext-whitetext-center">
<divclass="containerd-flexalign-items-centerflex-column">
<!--MastheadAvatarImage-->
<imgclass="masthead-avatarmb-5"src="assets/img/avataaars.svg"
alt="..." />
<!--MastheadHeading-->
<h1class="masthead-headingtext-uppercasemb-0">EmployeeManagment</h1>
<!--IconDivider-->
<divclass="divider-customdivider-light">
<divclass="divider-custom-line"></div>
<divclass="divider-custom-icon">
<iclass="fasfa-star"></i>
</div>
<divclass="divider-custom-line"></div>
</div>
<!--MastheadSubheading-->
<pclass="masthead-subheadingfont-weight-lightmb-0">Rohini
kalshetty</p>
</div>
</header>
</body>
</html>
Registration.jsp
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<metaname="viewport"content="width=device-width,initial-scale=1.0">
<metahttp-equiv="X-UA-Compatible"content="ie=edge">
<title>RegistrationForm</title>
<!--FontIcon-->
<linkrel="stylesheet"
href="fonts/material-icon/css/material-design-iconic-font.min.css">
<!--Maincss-->
<linkrel="stylesheet"href="css/style.css">
</head>
<body>
<divclass="main">
<!--Signupform-->
<sectionclass="signup">
<divclass="container">
<divclass="signup-content">
<divclass="signup-form">
<h2class="form-title">Registration</h2>
<formmethod="post"action="Registration"class="register-form"
id="register-form">
<divclass="form-group">
<labelfor="name"><i
class="zmdizmdi-accountmaterial-icons-name"></i></label><input
type="text" name="name" id="name" placeholder="Your Name" />
</div>
<divclass="form-group">
<label for="Department"><i class="zmdi zmdi-tv"></i></label><input
type="text"name="dept"id="dept"placeholder="YourDepartment"/>
</div>
<divclass="form-group">
<labelfor="join_date"><iclass="zmdizmdi-calendar"></i></label><input type="date"
name="join_date" id="join_date"/>
</div>
<divclass="form-group">
<labelfor="address"><iclass="zmdizmdi-swap-vertical-circle"></i></label>
<inputtype="text"name="address"id="address"
placeholder="Address" />
</div>
<divclass="form-group">
<labelfor="salary"><iclass="zmdizmdi-balance"></i></label>
<inputtype="text"name="salary"id="salary"
placeholder="Annual salary" />
</div>
<divclass="form-group">
<labelfor="contact"><iclass="zmdizmdi-phone"></i></label>
<inputtype="text"name="contact"id="contact"
placeholder="Contact no" />
</div>
<divclass="form-group">
<span><span></span></span>
</div>
<divclass="form-groupform-button">
<inputtype="submit"name="signup"id="signup"
class="form-submit" value="Register" />
</div>
</form>
</div>
<divclass="signup-image">
<figure>
<imgsrc="images/signup-image.jpg"alt="singupimage">
</figure>
<ahref="Details.jsp">ViewRecord
</a>
</div>
</div>
</div>
</section>
</div>
<!--JS-->
<scriptsrc="vendor/jquery/jquery.min.js"></script>
<scriptsrc="js/main.js"></script>
</body>
<!--ThistemplateswasmadebyColorlib(https://colorlib.com)-->
</html>
Registration.java
packagecom.code;
import java.io.IOException;
import java.sql.Connection;
importjava.sql.DriverManager;
import java.sql.PreparedStatement;
import javax.servlet.ServletConfig;
importjavax.servlet.ServletException;
importjavax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
/**
*ServletimplementationclassRegistration
*/
@WebServlet("/Registration")
publicclassRegistrationextendsHttpServlet{ priv
ate static final long serialVersionUID = 1L;
publicvoidinit(ServletConfigconfig)throwsServletException{
//TODOAuto-generatedmethodstub
}
/**
* @seeHttpServlet#doGet(HttpServletRequestrequest,HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request,
HttpServletResponseresponse)throwsServletException,IOException{ Sy
stem.out.println("Do get Method execute ");
}
protected void doPost(HttpServletRequest request,
HttpServletResponseresponse)throwsServletException,IOException{ Sy
stem.out.println("Do POST method execute");
Stringname=request.getParameter("name");
String dept = request.getParameter("dept");
Stringjoin_date=request.getParameter("join_date");
String address = request.getParameter("address");
String salary = request.getParameter("salary");
Stringcontact=request.getParameter("contact");
Details.jsp
<%@pageimport="java.sql.ResultSet"%>
<%@pageimport="java.sql.PreparedStatement"%>
<%@pageimport="com.conn.Databaseconnection"%>
<%@pageimport="java.sql.Connection"%>
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="utf-8"/>
<metaname="viewport"
content="width=device-width,initial-scale=1,shrink-to-fit=no"/>
<metaname="description"content=""/>
<metaname="author"content=""/>
<title>Details</title>
<!--tablecss-->
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"rel
="stylesheet"
integrity="sha384-
EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
<%
if(request.getParameter("delete")!=null)
{
out.print("<script>alert('DeleteDone...!')</script>");
}
%>
<!--Googlefonts-->
<linkhref="https://fonts.googleapis.com/css?family=Montserrat:400,700"
rel="stylesheet" type="text/css" />
<!--CorethemeCSS(includesBootstrap)-->
<linkhref="css/index-styles.css"rel="stylesheet"/>
</head>
<bodyclass="bg-light">
<!--cssfortable-->
<script
src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"i
ntegrity="sha384-
IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p"
crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js"i
ntegrity="sha384-
cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF"
crossorigin="anonymous"></script>
<!--Navigation-->
<nav
class="navbarnavbar-expand-lgbg-secondarytext-uppercasefixed-top"
id="mainNav">
<divclass="container">
<aclass="navbar-brand"href="#page-top">Employee</a>
<button
class="navbar-togglertext-uppercasefont-weight-boldbg-primarytext-white rounded"
type="button"data-bs-toggle="collapse"
data-bs-target="#navbarResponsive"aria-controls="navbarResponsive"
aria-expanded="false" aria-label="Toggle navigation">
Menu<iclass="fasfa-bars"></i>
</button>
<divclass="collapsenavbar-collapse"id="navbarResponsive">
<ulclass="navbar-navms-auto">
<liclass="nav-itemmx-0mx-lg-1"><a
class="nav-linkpy-3px-0px-lg-3rounded"href="registration.jsp">Register</a></li>
<liclass="nav-itemmx-0mx-lg-1"><a
class="nav-linkpy-3px-0px-lg-3rounded"href="Details.jsp">ViewEmployee detail</a></li>
<liclass="nav-itemmx-0mx-lg-1"><a
class="nav-linkpy-3px-0px-lg-3rounded"href="index.jsp">Home</a></li>
</ul>
</div>
</div>
</nav>
<!--table-->
<br/><br/><br/>
<divclass="containerp-5">
<divclass="card">
<divclass="card-body">
<pclass="text-centerfs-1">AllEmployeeDetails</p>
<tableclass="table">
<thead>
<tr>
<thscope="col">Id</th>
<thscope="col">Name</th>
<thscope="col">Department</th>
<thscope="col">JoiningDate</th>
<thscope="col">Address</th>
<thscope="col">AnnualSalary</th>
<thscope="col">Contact</th>
<thscope="col">Action</th>
</tr>
</thead>
</tbody>
<%
Connectioncon=Databaseconnection.getConnection();
PreparedStatementps=con.prepareStatement("SELECT*FROMemployee_detail");
ResultSet rs=ps.executeQuery();
inti=0;
while(rs.next())
{
Stringid=rs.getString("id");
%>
<tbody>
<tr>
<thscope="row"><%=id%></th>
<td><%=rs.getString("name")%></td>
<td><%=rs.getString("dept")%></td>
<td><%=rs.getString("join_date")%></td>
<td><%=rs.getString("address")%></td>
<td><%=rs.getString("salary")%></td>
<td><%=rs.getString("contact")%></td>
<td>
<ahref="UpdateRecord.jsp?id=<%=id%>"class="btnbtn-smbtn-
primary">Update</a>
<ahref="DeleteUser?id=<%=id%>"class="btnbtn-smbtn-dangerms-1">Delete</a>
</td></tr>
<%
}
%>
</table>
</div>
</div>
</body>
</html>
Assignment6
UpdateRecord.jsp
<%@pageimport="java.sql.ResultSet"%>
<%@pageimport="java.sql.PreparedStatement"%>
<%@pageimport="java.sql.Connection"%>
<%@pageimport="com.conn.Databaseconnection"%>
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<metaname="viewport"content="width=device-width,initial-scale=1.0">
<metahttp-equiv="X-UA-Compatible"content="ie=edge">
<title>updaterecord</title>
<!--FontIcon-->
<linkrel="stylesheet"
href="fonts/material-icon/css/material-design-iconic-font.min.css">
<!--Maincss-->
<linkrel="stylesheet"href="css/style.css">
</head>
<body>
<%
Stringid=request.getParameter("id");
Connectioncon=Databaseconnection.getConnection();
PreparedStatementps=con.prepareStatement("SELECT*FROM`employee_detail`
WHERE id='"+id+"'");
ResultSetrs=ps.executeQuery();
if(rs.next())
{
Stringdept=rs.getString("dept");
%>
<divclass="main">
<!--Signupform-->
<sectionclass="signup">
<divclass="container">
<divclass="signup-content">
<divclass="signup-form">
<h2class="form-title">UpdateRecord</h2>
<formaction="UpdateRecord"method="post"
>
<divclass="form-group">
<input
type="hidden"name="id"id="id"value="<%=id%>"/>
</div>
<divclass="form-group">
<labelfor="name"><i
class="zmdi zmdi-account material-icons-name"></i></label><input
type="text"name="name"id="name"value="<%=rs.getString("name")%>"/>
</div>
<divclass="form-group">
<label for="Department"><i class="zmdi zmdi-tv"></i></label><input
type="text"name="dept"value="<%=rs.getString("dept")%>"id="dept"/>
</div>
<divclass="form-group">
<labelfor="join_date"><iclass="zmdizmdi-calendar"></i></label><input type="date"
name="join_date" value="<%=rs.getString("join_date")%>" id="join_date"/>
</div>
<divclass="form-group">
<labelfor="address"><iclass="zmdizmdi-swap-vertical-circle"></i></label>
<inputtype="text"name="address"id="address" value="<
%=rs.getString("address")%>"/>
</div>
<divclass="form-group">
<labelfor="salary"><iclass="zmdizmdi-balance"></i></label>
<inputtype="text"name="salary"id="salary"
value="<%=rs.getString("salary")%>" />
</div>
<divclass="form-group">
<labelfor="contact"><iclass="zmdizmdi-phone"></i></label>
<inputtype="text"name="contact"id="contact"
value="<%=rs.getString("contact")%>" />
</div>
<divclass="form-group">
<span><span></span></span>
</div>
<divclass="form-groupform-button">
<inputtype="submit"name="signup"id="signup"
class="form-submit" value="Update" />
</div>
</form>
<%}%>
</div>
<divclass="signup-image">
<figure>
<imgsrc="images/signup-image.jpg"alt="singupimage">
</figure>
<ahref="Details.jsp">ViewRecord
</a>
</div>
</div>
</div>
</section>
</div>
<!--JS-->
<scriptsrc="vendor/jquery/jquery.min.js"></script>
<scriptsrc="js/main.js"></script>
</body>
<!--ThistemplateswasmadebyColorlib(https://colorlib.com)-->
</html>
UpdateRecord.java
package com.code;
importjava.io.IOException;
importjava.sql.Connection;
importjava.sql.PreparedStatement;
import javax.servlet.ServletConfig;
importjavax.servlet.ServletException;
importjavax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
import com.conn.Databaseconnection;
/**
*ServletimplementationclassUpdateRecord
*/
@WebServlet("/UpdateRecord")
publicclassUpdateRecordextendsHttpServlet
{
staticConnectioncon=null;
publicvoidinit(ServletConfigconfig)throwsServletException
{
try
{
con=Databaseconnection.getConnection();
}catch(Exceptione)
{
System.out.println("Exc"+e);
}
}
protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)
throws ServletException, IOException
{
Stringid=request.getParameter("id");
Stringname=request.getParameter("name");
String dept = request.getParameter("dept");
Stringjoin_date=request.getParameter("join_date");
String address = request.getParameter("address");
String salary = request.getParameter("salary");
Stringcontact=request.getParameter("contact"); try
{
PreparedStatementps=con.prepareStatement("UPDATE`employee_detail`SET
`name`='"+name+"',`dept`='"+dept+"',`join_date`='"+join_date+"',`address`='"+add
ress+"',`salary`='"+salary+"',`contact`='"+contact+"' WHERE `id`='"+id+"'");
intr=ps.executeUpdate();
if(r>0)
{
System.out.println("All Information Updated...!"); response.sendRedirect("Details.jsp?
update=done");
}
else
{
System.out.println("Update Operation Fail...!"); response.sendRedirect("Details.jsp?
fail=update");
}
}catch(Exceptione)
{
System.out.println("Exc"+e);
}
}
}
DeleteUser.java
package com.code;
importjava.io.IOException;
importjava.sql.Connection;
importjava.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
importjavax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
import com.conn.Databaseconnection;
/**
*ServletimplementationclassDeleteUser
*/
@WebServlet("/DeleteUser")
public class DeleteUser extends HttpServlet
{ privatestaticfinallongserialVersionUID=1L;
/**
*@seeServlet#init(ServletConfig)
*/
publicvoidinit(ServletConfigconfig)throwsServletException{
//TODOAuto-generatedmethodstub
}
/**
*@seeHttpServlet#doGet(HttpServletRequestrequest,HttpServletResponse
response)
*/
protectedvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse) throws
ServletException, IOException
{Stringid=request.getParameter("id");
Connectioncon=Databaseconnection.getConnection();
try{
PreparedStatementps=con.prepareStatement("DELETEFROM`employee_detail` WHERE
id='"+id+"'");
inti=ps.executeUpdate();
if(i>0)
{System.out.println("DeleteDone"+id);
response.sendRedirect("Details.jsp?delete=done");
}else
{
System.out.println("Delete Fail...!");
response.sendRedirect("Details.jsp?fail=delete");
}
}catch(Exceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}
}
}
*OUTPUT
Index page
Registration page
Details page
Delete message
Update page