Overall process of example: When a new user select the “Sign Up” option from the registration page the request is sent to the SignUP Servlet, the servlet read the values of username and password from request. The new user registration module has been linked with Login module.
Servlet defines the Database connection with valid database connection information.
Prepared statement is used to check the username and password exists in users table. then, the same prepared statement is used to add new user information in database.
OS : Windows 10 Jdk : Version 8 IDE : Eclipse Mars Database : MySQL using MySql Workbench 5.2 CE Server : Apache Tomcat 7
Overall process of example: When a client/user select the “Submit” option from the clients page the request is sent to the Login Servlet, the servlet read the values of username and password from request.
Servlet defines the Database connection with valid database connection information.
Then, prepared statement is used to execute the queries. Here i have use used the prepared statement to check the username and password is exist in users table.
OS : Windows 10 Jdk : Version 8 IDE : Eclipse Mars Database : MySQL using MySql Workbench 5.2 CE Server : Apache Tomcat 7
This video features the CRUD operation using JDBC via servlet only, no JSP page is used to perform any database operation. CRUD is Create, Read, Update & Delete.
Index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Servlet with JDBC</title>
</head>
<body>
<form action="AddEmp" method="post">
<h1> Employee Management</h1>
<p> Enter Emp. No : <input type="text" name="txtEno"> </p>
<p> Enter Emp. Name : <input type="text" name="txtEname"> </p>
<p> Enter Emp. Salary : <input type="text" name="txtEsalary"> </p>
<p> DB Operation :
<select name="op">
<option value="1">Add</option>
<option value="2">Update</option>
<option value="3">Delete</option>
<option value="4">Display</option>
</select>
</p>
<p> <input type="submit" value="Submit"> </p>
</form>
</body>
</html>
It is generally the table operation to create, access, manipulate, and delete the data from a database table. Here, only a single Servlet is performing all the CRUD operation. Operation is decided by the client by selecting a proper option from list of choices.
When a client/user select the “Add” option, the internal value of that option is checked to perform the add operation, like wise when user/client select the “Update” operation the record is updated with given details.
If user/client decide to delete the record the valid number is given and the delete operation is carried.
Finally, if user decides to display all the record there is an option called “Display” to view all the details of the table.
OS : Windows 10 Jdk : Version 8 IDE : Eclipse Mars Database : MySQL using MySql Workbench 5.2 CE Server : Apache Tomcat 7
Video features introduction to Session management. To track the user session various session tracking approaches are there in servlet. Here, the Cookies is discussed with suitable example. Index page is used to read user’s name from the client, at the server side there are three servlets. First servlet receives the input/request from the index page, then the session information added using Cookies, then the second servlet also adds the session information in the second servlet using Cookies, and finally third servlet gets the client session information from second servlet.
OS : Windows 10 Jdk : Version 8 IDE : Eclipse Mars Server : Apache Tomcat 7
Video features introduction to Session management. To track the user session various session tracking approaches are there in servlet. Here, the HttpSession is discussed with suitable example. Index page is used for multiple purpose, here i have define two forms which are referring to same form, but with different method type. First form is referring to doGet method whereas later referring to doPost methods. With doGet method session is defined and doPost method is used to retrieve session the session and its attributes. Following are the list of files used in the example (index.html, LoginServlet.java).
OS : Windows 10 Jdk : Version 8 IDE : Eclipse Mars Server : Apache Tomcat 7
Here, the Cookies are added in response object, two cookies with static values are set and the one cookie is set with value from Index page. index page is used to read user’s name from the client, at the server side there are three servlets. First servlet receives the input/request from the index page, then the session information added using Cookies, then the second servlet also adds the session information in the second servlet using Cookies, and finally third servlet gets the client session information from second servlet. Video features introduction to Session management. To track the user session various session tracking approaches are there in servlet.
OS : Windows 10 Jdk : Version 8 IDE : Eclipse Mars Server : Apache Tomcat 7
Video features introduction to Session management. To track the user session various session tracking approaches are there in servlet. Here, the HttpSession is discussed with suitable example. Index page is used to read user’s name from the client, at the server side there are three servlets. First servlet receives the input/request from the index page, then the session information added using HttpSession, then the second servlet also adds the session information in the second servlet using HttpSession, and finally third servlet gets the client session information from second servlet.
OS : Windows 10 Jdk : Version 8 IDE : Eclipse Mars Server : Apache Tomcat 7
Video features introduction to Session management. To track the user session various session tracking approaches are there in servlet. Here, the Hidden Form fields is discussed with suitable example. Index page is used to read user’s name from the client, at the server side there are three servlets. First servlet receives the input/request from the index page, then the session information added using Hidden Form fields, then the second servlet also adds the session information in the second servlet using Hidden Form fields, and finally third servlet gets the client session information from second servlet.