-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nareshit
authored and
Nareshit
committed
Nov 17, 2021
1 parent
0236efc
commit 054a79b
Showing
26 changed files
with
281 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src/main/java"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v10.0"> | ||
<attributes> | ||
<attribute name="owner.project.facets" value="jst.web"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> | ||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> | ||
<classpathentry kind="lib" path="C:/oraclexe/app/oracle/product/11.2.0/server/jdbc/lib/ojdbc6.jar"/> | ||
<classpathentry kind="output" path="build/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>EmployeeSearchApp</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.wst.common.project.facet.core.builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.wst.validation.validationbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> | ||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> | ||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/> | ||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject"> | ||
<attributes> | ||
<attribute name="hide" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/> | ||
<classpathentry kind="output" path=""/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16 | ||
org.eclipse.jdt.core.compiler.compliance=16 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> | ||
<wb-module deploy-name="EmployeeSearchApp"> | ||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> | ||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> | ||
<property name="context-root" value="EmployeeSearchApp"/> | ||
<property name="java-output-path" value="/EmployeeSearchApp/build/classes"/> | ||
</wb-module> | ||
</project-modules> |
10 changes: 10 additions & 0 deletions
10
EmployeeSearchApp/.settings/org.eclipse.wst.common.project.facet.core.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<faceted-project> | ||
<runtime name="Apache Tomcat v10.0"/> | ||
<fixed facet="jst.web"/> | ||
<fixed facet="wst.jsdt.web"/> | ||
<fixed facet="java"/> | ||
<installed facet="java" version="16"/> | ||
<installed facet="jst.web" version="5.0"/> | ||
<installed facet="wst.jsdt.web" version="1.0"/> | ||
</faceted-project> |
1 change: 1 addition & 0 deletions
1
EmployeeSearchApp/.settings/org.eclipse.wst.jsdt.ui.superType.container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary |
1 change: 1 addition & 0 deletions
1
EmployeeSearchApp/.settings/org.eclipse.wst.jsdt.ui.superType.name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Window |
Binary file added
BIN
+4.6 KB
EmployeeSearchApp/build/classes/com/nt/servlet/EmployeeSearchServlet.class
Binary file not shown.
103 changes: 103 additions & 0 deletions
103
EmployeeSearchApp/src/main/java/com/nt/servlet/EmployeeSearchServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
//EmployeeSearchServlet.java | ||
package com.nt.servlet; | ||
|
||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.PreparedStatement; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
import jakarta.servlet.ServletException; | ||
import jakarta.servlet.http.HttpServlet; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
|
||
public class EmployeeSearchServlet extends HttpServlet { | ||
private static final String GET_EMP_INFO="SELECT EMPNO,ENAME,JOB,SAL,DEPTNO FROM EMP WHERE EMPNO=?"; | ||
@Override | ||
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { | ||
// set response content type | ||
res.setContentType("text/html"); | ||
//get PrintWriter | ||
PrintWriter pw=res.getWriter(); | ||
//read form data | ||
int eno=Integer.parseInt(req.getParameter("eno")); | ||
//write jdbc code | ||
Connection con=null; | ||
PreparedStatement ps=null; | ||
ResultSet rs=null; | ||
try { | ||
//Load jdbc driver class | ||
Class.forName("oracle.jdbc.driver.OracleDriver"); | ||
//establish the connection | ||
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system","manager"); | ||
//create Jdbc Statement object | ||
ps=con.prepareStatement(GET_EMP_INFO); | ||
//set IN param values | ||
ps.setInt(1, eno); | ||
//execute the SQL query | ||
rs=ps.executeQuery(); | ||
//process the ResultSet | ||
if(rs.next()) { | ||
pw.println("<h1 style='color:red;text-align:center'>"+eno+" Employee Details are </h1>"); | ||
pw.println("<table border='1' align='center'>"); | ||
pw.println("<tr> <td>Empno:: </td> <td>"+rs.getInt(1)+" </td> </tr>"); | ||
pw.println("<tr> <td>Emp Name:: </td> <td>"+rs.getString(2)+" </td> </tr>"); | ||
pw.println("<tr> <td>Emp Desg:: </td> <td>"+rs.getString(3)+" </td> </tr>"); | ||
pw.println("<tr> <td>Emp Salary:: </td> <td>"+rs.getFloat(4)+" </td> </tr>"); | ||
pw.println("<tr> <td>Emp DeptNo:: </td> <td>"+rs.getInt(5)+" </td> </tr>"); | ||
pw.println("</table>"); | ||
}//if | ||
else { | ||
pw.println("<h1 style='color:red;text-align:center'> Employee Details are not found </h1>"); | ||
}//else | ||
|
||
|
||
}//try | ||
catch(SQLException se) { | ||
se.printStackTrace(); | ||
pw.println("<h1 style='color:red;text-align:center'> Problem in DB Interaction </h1>"); | ||
} | ||
catch(Exception e) { | ||
e.printStackTrace(); | ||
pw.println("<h1 style='color:red;text-align:center'> Unknown Problem </h1>"); | ||
} | ||
finally { | ||
//close jdbc objs | ||
try { | ||
if(rs!=null) | ||
rs.close(); | ||
}//try | ||
catch(SQLException se) { | ||
se.printStackTrace(); | ||
} | ||
try { | ||
if(ps!=null) | ||
ps.close(); | ||
} | ||
catch(SQLException se) { | ||
se.printStackTrace(); | ||
} | ||
try { | ||
if(con!=null) | ||
con.close(); | ||
} | ||
catch(SQLException se) { | ||
se.printStackTrace(); | ||
} | ||
}//finally | ||
//add home hyperlink | ||
pw.println("<h1 style='text-align:center'> <a href='input.html'>home </a> </h1>"); | ||
|
||
//close stream | ||
pw.close(); | ||
}//doGet(-,-) | ||
|
||
@Override | ||
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { | ||
doGet(req,res); | ||
}//doPost(-,-) | ||
|
||
}//class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Class-Path: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app id="WebApp_ID" version="2.4" | ||
xmlns="http://java.sun.com/xml/ns/j2ee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> | ||
|
||
|
||
|
||
<servlet> | ||
<servlet-name>search</servlet-name> | ||
<servlet-class>com.nt.servlet.EmployeeSearchServlet</servlet-class> | ||
</servlet> | ||
<servlet-mapping> | ||
<servlet-name>search</servlet-name> | ||
<url-pattern>/empdburl</url-pattern> | ||
</servlet-mapping> | ||
|
||
<welcome-file-list> | ||
<welcome-file>input.html</welcome-file> | ||
</welcome-file-list> | ||
|
||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
|
||
|
||
<h1 style="color:red;text-align:center"> Html to Servlet interaction </h1> | ||
|
||
<form action="empdburl" method="POST"> | ||
<table align="center" bgcolor="cyan"> | ||
<tr> | ||
<td>Enter Employee no::</td> | ||
<td><input type="text" name="eno"> </td> | ||
</tr> | ||
<tr> | ||
<td><input type="submit" value="search"> </td> | ||
<td><input type="reset" value="cancel"> </td> | ||
</tr> | ||
</table> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16 | ||
org.eclipse.jdt.core.compiler.compliance=16 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=16 | ||
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file modified
BIN
+517 Bytes
(130%)
MarriageApp-LifeCycle/build/classes/com/nt/servlet/LcTestServlet.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16 | ||
org.eclipse.jdt.core.compiler.compliance=16 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=16 | ||
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
MarriageApp/build/classes/com/nt/servlet/HomePageServlet.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
MarriageApp/build/classes/com/nt/servlet/LcTestServlet.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
MarriageApp/build/classes/com/nt/servlet/MarriageElgibilityCheckServlet.class
Binary file not shown.