Develop Java MVC web apps using MyBatis, Servlets and JSP by Vinod Kayartaya

Develop Java MVC web apps using MyBatis, Servlets and JSP

79 lectures - 10 hr 13 mins

What's included?

Video Icon 79 videos File Icon 1 file

Contents

Introduction
Course Intro
9 mins
Software required on your PC / Laptop
2 mins
Examples.zip
8.63 MB
What you need to know about Apache MyBatis?
Overview of MyBatis
4 mins
Eclipse project with required dependencies
7 mins
Starting the H2 database in server mode
11 mins
Entity classes using Lombok
7 mins
Configuring MyBatis to work with our database
3 mins
CustomerDao mapper interface
9 mins
DaoFactory for creating a CustomerDao instance
5 mins
Add new customer
8 mins
Retrieve a customer by id
2 mins
Update customer data
3 mins
Delete a customer record
5 mins
Get all customers
2 mins
Get customers by city
3 mins
Java EE web components - Servlets and JSP
Overview of web applications in Java
11 mins
WAR structure
4 mins
Setting up Apache Tomcat in Eclipse
9 mins
Create a Maven web project
10 mins
Servlet, GenericServlet and HttpServlet
6 mins
Our first servlet class
12 mins
Handling request parameters
9 mins
Client side redirection
6 mins
Server side include and forward
7 mins
The request scope
19 mins
The session scope
18 mins
The application scope
9 mins
Introducing JavaServer Pages (JSP)
5 mins
Our first JSP
12 mins
JSP Elements
8 mins
JSP scripting elements demo
13 mins
Creating a JSP custom action
16 mins
Advanced custom action demo
21 mins
JSP Expression Language
15 mins
Overview of JSP Standard Tag Library
4 mins
A simple MVC demo
20 mins
Cookies
17 mins
Filters
17 mins
Setting up the Phonebook MVC application
Setting up the project (css, homepage, header, footer)
18 mins
Database schema
8 mins
The DAO layer
13 mins
The Service layer
2 mins
Registration module
Overview of registration process
4 mins
DAO functions - createUser and getUserByEmail
8 mins
Service function - registerUser
7 mins
Controller servlet - RegisterServlet
8 mins
View - register.jsp
13 mins
Encrypt password using BCrypt
4 mins
Dashboard controller and view
5 mins
Login and Logout module
Render the login form to the user
5 mins
Handling POST submission in LoginServlet
5 mins
The login() business method in UserService
7 mins
Implementing the logout feature
5 mins
Conditional display menu items in the header
4 mins
Login check filter
Securing access to resources using a filter
7 mins
Add new contact module
Render a link and a form to add new contact
10 mins
Handle POST submission from contactForm
6 mins
Service function - addNewContact()
15 mins
Implementing the DAO function - createContact()
9 mins
View contact module
DAO function - getContactById()
2 mins
Service function - getContactById()
3 mins
Controller - ViewContactServlet
5 mins
View - show-contact.jsp
18 mins
View all contacts module
DAO function - getAllContacts()
2 mins
Service function - getAllContacts()
2 mins
Controller - ViewAllContactsController
4 mins
View - show-contacts.jsp
17 mins
Edit contact module
Viewing contact details in a form for editing
8 mins
DAO function - updateContact()
2 mins
Service function - updateContact()
4 mins
Controller - EditUpdateContactController
7 mins
Shifting reusable code to a filter
7 mins
Delete contact module
DAO function - deleteContact()
4 mins
Service function - deleteContact()
3 mins
Controller - DeleteContactServlet
11 mins
Deleting a contact from different views
10 mins
More features
Changing the appearance (theme) of our application dynamically
15 mins
Build and deploy
Creating a production build
9 mins
Deploy to a local Apache Tomcat Server
5 mins

Requirements

  • Basic knowledge of Java programming language is good enough
  • Basic knowledge of HTML will help, but not necessary

What you will learn in this course?

  • Learn the basics of MyBatis
  • Understand SQL-Mappers
  • CURD operations using MyBatis
  • Build a DAO layer using MyBatis
  • Create a Java dynamic web application using Servlets
  • Differentiate between GenericServlet and HttpServlet
  • Understand servlet life cycle functions
  • Read and process HTTP request (query string) parameters
  • Understand different scopes - request, session and application
  • Generate different types of content (like .doc or .xls) based on user choice
  • Understand the JSP architecture
  • Understand JSP life cycle functions
  • Combine Servlet and JSP to handle a single HTTP request
  • Learn how JSP Custom tags work
  • Learn JSP Expression Language and JSP Standard Tag Libraries (JSTL)
  • Create a full fledged MVC application

Description

Servlets and JSP

A Java servlet is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web applications on web servers and thus qualify as a server-side servlet web API. Such web servlets are the Java counterpart to other dynamic web content technologies such as PHP and ASP.NET.

A Java servlet processes or stores a Java class in Java EE that conforms to the Java Servlet API, a standard for implementing Java classes that respond to requests. Servlets could in principle communicate over any client–server protocol, but they are most often used with HTTP. Thus "servlet" is often used as shorthand for "HTTP servlet". Thus, a software developer may use a servlet to add dynamic content to a web server using the Java platform. The generated content is commonly HTML, but may be other data such as XML and more commonly, JSON. Servlets can maintain state in session variables across many server transactions by using HTTP cookies, or URL mapping.

To deploy and run a servlet, a web container must be used. A web container (also known as a servlet container) is essentially the component of a web server that interacts with the servlets. The web container is responsible for managing the lifecycle of servlets, mapping a URL to a particular servlet and ensuring that the URL requester has the correct access rights.

The Servlet API, contained in the Java package hierarchy javax.servlet, defines the expected interactions of the web container and a servlet.

Servlets can be generated automatically from JavaServer Pages (JSP) by the JavaServer Pages compiler. The difference between servlets and JSP is that servlets typically embed HTML inside Java code, while JSPs embed Java code in HTML. While the direct usage of servlets to generate HTML has become rare, the higher level MVC web framework in Java EE (JSF) still explicitly uses the servlet technology for the low level request/response handling via the FacesServlet. A somewhat older usage is to use servlets in conjunction with JSPs in a pattern called "Model 2", which is a flavour of the model–view–controller.

MyBatis is a Java persistence framework that couples objects with stored procedures or SQL statements using an XML descriptor or annotations.

Apache MyBatis

MyBatis is free software that is distributed under the Apache License 2.0.

MyBatis is a fork of iBATIS 3.0 and is maintained by a team that includes the original creators of iBATIS.

Unlike ORM frameworks, MyBatis does not map Java objects to database tables but Java methods to SQL statements.

MyBatis lets you use all your database functionality like stored procedures, views, queries of any complexity and vendor proprietary features. It is often a good choice for legacy or de-normalized databases or to obtain full control of SQL execution.

It simplifies coding compared to JDBC. SQL statements are executed with a single line.

MyBatis provides a mapping engine that maps SQL results to object trees in a declarative way.

Who this course is for?

  • Core Java developers who want to learn about advanced concepts in Java
  • Web developers with Java knowledge who want to build powerful dynamic/interactive web applications
  • Developers from other programming background who want to explore MVC in Java

Hi. My name is Vinod

Hi, my name is Vinod, and I am a software trainer, consultant and freelance developer. I am the creator some of the highest rated courses on Udemy. In my professional career, I have trained hundreds of thousands of software engineers. Teaching is not only my profession, but also a passion. Creating online courses gives me the opportunity to reach and help students across the world.