Creating MVC Database Web Application in JSP and Servlets – [Create, Read, Update, Delete]

Hello guys, Bushan here, welcome to B2 Tech. In this article, we will be Creating fully fledged MVC database web application using JSP and Servlets, we are going to perform basic database operations Create, Read, Update and Delete.

So, we are creating an Employee Directory Web Application which keeps track of each employee details such as Name, Date of birth, Department and it should have the following features

  • List Employee
  • Add a new Employee
  • Update an Employee
  • Delete an Employee

The below big picture is the architecture of the Employee Directory Web Application

Step 1: Browser sends a request to EmployeeController, it will process that request, if any additional data is required, it will redirect it to EmployeeDAO

Step 2: EmployeeDAO, its responsibility is to interact with a database like querying to the database, adding a records etc.., It takes the database connection from a helper class DBConnectionUtil and talk to the database for additional data, and send the data back to EmployeeController

Step 3: EmployeeController will write that data to a respective JSP

Step 4: JSP will organize the data and send the JSP back to the Browser

So now let’s jump into developing an application, before that a quick look at the project structure






Alright, that’s it for this post, i hope this post is helped you in someway or the other way, if it did then please share this with your friends, colleague and someone who is looking for this. You can also find the fully working project in my github repository @

Thanks and Regards,
Team B2 Tech 

About the author

Bushan Sirgur

Well, I am Bushan Sirgur from Banglore, India. Currently, I am working as a Software Developer in a Service Base Company. I am interested in JAVA/J2EE, Angular 2, JavaScript, jQuery, MongoDB.

View all posts


  • First of all thanks for the tutorial. It was exactly what I needed and very helpful. But I have a problem. in ’employee-list.jsp’, you used ‘ ‘ command line. I did not understood how that works because I can’t get anything from my list. Where did you connected EmployeeController and employee-list.jsp

    • c:forEach items=”${list}” var=”employee” this command line but It didn’t show up for some reason sorry.

      • Hello Gulhan,

        Please check in the controller whether you have added the list to the request object or not. If you added then it should work. Please cross check and let me know. 🙂

        Thanks and Regards,
        Team B2 Tech

        • First of all thanks for the answer. I have and setted the attribute on Controller. But when I called from jsp, It returns a null list. So I tried to setattribute on jsp before I use ” c:forEach items=”${list}” var=”employee”” command and It worked. But I don’t want to set on jsp, I want to set it on controller. What do you think the problem could be ?.

    • The docs for are probably about as good an explanation as you’ll get:

      The serialization runtime associates with each serializable class a version number, called a serialVersionUID, which is used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible with respect to serialization. If the receiver has loaded a class for the object that has a different serialVersionUID than that of the corresponding sender’s class, then deserialization will result in an InvalidClassException. A serializable class can declare its own serialVersionUID explicitly by declaring a field named serialVersionUID that must be static, final, and of type long:

      ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;

      If a serializable class does not explicitly declare a serialVersionUID, then the serialization runtime will calculate a default serialVersionUID value for that class based on various aspects of the class, as described in the Java(TM) Object Serialization Specification. However, it is strongly recommended that all serializable classes explicitly declare serialVersionUID values, since the default serialVersionUID computation is highly sensitive to class details that may vary depending on compiler implementations, and can thus result in unexpected InvalidClassExceptions during deserialization. Therefore, to guarantee a consistent serialVersionUID value across different java compiler implementations, a serializable class must declare an explicit serialVersionUID value. It is also strongly advised that explicit serialVersionUID declarations use the private modifier where possible, since such declarations apply only to the immediately declaring class serialVersionUID fields are not useful as inherited members.

  • No one can execute this code without considering id value in database which is required as reference in each controller executio

Leave a Reply

Your email address will not be published. Required fields are marked *