Filename: Employee16.html
<!-- 16. HTML Program to accept Employee Name -->
<html>
<head>
<title>Employee Salary Statement</title>
</head>
<body>
<h3>Enter the Name of Employee:<h3>
<form action="Employee16.jsp" method="POST" >
<input type="text" name="ename" autofocus><br><br>
<input type="submit" value="Generate Statement">
</body>
</html>
Filename: Employee16.jsp
<!-- 16. JSP Program to Retrieve Employee Information from the Database. -->
<html>
<head>
<title>Employee Salary Statement</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<%
String ename=request.getParameter("ename");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:emp16");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from emp16 where ename='"+ename+"'");
while(rs.next())
{
%>
<CENTER>
<table border=5 bgcolor="orange" height=600 width=400 >
<caption><h2><font color="blue" >SALARY STATEMENT</font></h2></caption>
<tr><td>Name</td><td><%=rs.getString("ename")%></td></tr>
<tr><td>Department</td><td><%=rs.getString("dept")%></td></tr>
<tr><td>Designation</td><td><%=rs.getString("des")%></td></tr>
<tr><td>Basic Salary</td><td><%=rs.getString("bsal")%></td></tr>
<tr><td>TA</td><td><%=rs.getString("ta")%></td></tr>
<tr><td>DA</td><td><%=rs.getString("da")%></td></tr>
<tr><td>HRA</td><td><%=rs.getString("hra")%></td></tr>
<tr><td>Gross Salary</td><td><%=rs.getString("gsal")%></td></tr>
<tr><td>PF</td><td><%=rs.getString("pf")%></td></tr>
<tr><td>IT</td><td><%=rs.getString("it")%></td></tr>
<tr><td>Net Salary</td><td><%=rs.getString("netsal")%></td></tr>
</table>
</CENTER>
<%
}
rs.close();
st.close();
con.close();
%>
</body>
</html>
<!-- 16. HTML Program to accept Employee Name -->
<html>
<head>
<title>Employee Salary Statement</title>
</head>
<body>
<h3>Enter the Name of Employee:<h3>
<form action="Employee16.jsp" method="POST" >
<input type="text" name="ename" autofocus><br><br>
<input type="submit" value="Generate Statement">
</body>
</html>
Filename: Employee16.jsp
<!-- 16. JSP Program to Retrieve Employee Information from the Database. -->
<html>
<head>
<title>Employee Salary Statement</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<%
String ename=request.getParameter("ename");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:emp16");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from emp16 where ename='"+ename+"'");
while(rs.next())
{
%>
<CENTER>
<table border=5 bgcolor="orange" height=600 width=400 >
<caption><h2><font color="blue" >SALARY STATEMENT</font></h2></caption>
<tr><td>Name</td><td><%=rs.getString("ename")%></td></tr>
<tr><td>Department</td><td><%=rs.getString("dept")%></td></tr>
<tr><td>Designation</td><td><%=rs.getString("des")%></td></tr>
<tr><td>Basic Salary</td><td><%=rs.getString("bsal")%></td></tr>
<tr><td>TA</td><td><%=rs.getString("ta")%></td></tr>
<tr><td>DA</td><td><%=rs.getString("da")%></td></tr>
<tr><td>HRA</td><td><%=rs.getString("hra")%></td></tr>
<tr><td>Gross Salary</td><td><%=rs.getString("gsal")%></td></tr>
<tr><td>PF</td><td><%=rs.getString("pf")%></td></tr>
<tr><td>IT</td><td><%=rs.getString("it")%></td></tr>
<tr><td>Net Salary</td><td><%=rs.getString("netsal")%></td></tr>
</table>
</CENTER>
<%
}
rs.close();
st.close();
con.close();
%>
</body>
</html>
No comments :
Post a Comment