Comprehensive course on Java Servlet with practical examples and coding on the go. Develop useful web-based applications
What you'll learn:
- Deep-dive into the world of Java Servlets
- Become a top web programmer with Java Servlet programming skills
- Java Servlet Architecture
- Important terms related to Java Servlets
- How Servlet works and Servlet Life Cycle
- ServletRequest, ServletResponse, ServletConfig, and ServletContext
- Steps to configure and deploy Servlet
- Servlet Collaboration
- Understand Java EE - Servlets, JSP, Scriptlets, JSTL, web-xml and EL
- Understand static and Dynamic webpages
- Create complex web applications using servlets
- Servlet interface, Generic and HttpServlet interfaces
- Annotation and Xml based configuration in Servlets
- Difference between Get & Post
- Load On Startup Configuration
- Request Scope in Servlets
- RequsetDispatcher interface
- Interservlet communication using Response sendRedirect
- Session Tracking using cookies
- HiddenFormFields, Url Rewriting, HttpSession
- Filters in servlets, FilterConfig
- Database connection in servlets
- CRUD operations using servlets to mysql database
- Events and Listeners in servlets
- ServletContext Listener and HttpSessionListener
- Understand the basics of using Maven, Tomcat and Eclipse
- Run Web Applications in Tomcat
A Servlet is a Java Programming language class that is used to extend the capabilities of servers that host applications accessed by means of a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by web servers. It is also a web component that is deployed on the server to create a dynamic web page.
Servlet Technology resides at server side and it generates dynamic web page, used to create web application. Java Servlets are programs that act as a middle layer between a requests coming from a Web browser / HTTP client and databases or the applications on the HTTP server.
Servlet is a Java class that runs inside the container. It allows you to process the HTTP request and generate dynamic web pages, but it's more Java then HTML like you need to code HTML inside Java, which is both erroneous and not recommended. Servlet is mainly used as a Controller in web applications created using the MVC design pattern. One of the famous examples of that is the DispatcherServlet of Spring MVC framework, which acts as a front controller. Its job is to receive request and process it, but the view generate or dynamic web page generation functionality is passed down to JSP. Though it provides the data that need to be shown in JSP, which makes the view part of the Model View Controller (MVC) design pattern.
Before servlets, we had CGI i.e. Common Gateway Interface. It is a standard way for a Web server to pass a user’s request to an application program and receives the response to forward to the user. When the user requests a Web page, the server sends back the requested page. However, when a user fills out a form on a Web page and sends it in, it is processed by an application program. The Web server typically passes the form information to a small application program. This program processes the data and sends back a confirmation message. This process of passing data back and forth between the server and the application is called the common gateway interface (CGI). It is part of the Web’s Hypertext Transfer Protocol.
This practical, application-oriented Java Servlets training by Uplatz teaches Java Servlets technology and shows how to use it to develop simple to complex web applications. It is intended for both the beginners as well as experienced Java (J2SE) programmers who want to build web applications or J2EE components and systems.
The Java Servlet course begins with an overview of server-side Java programming and web protocols. Then students learn the Java Servlets architecture, the request/response cycle, and servlet life cycle, and how to build interactive web applications that parse and/or generate HTML forms. Several prominent patterns for servlet application architecture are considered. Sessions are studied as a means to developing sophisticated client/server conversations over several HTML pages. Multi-tier applications are developed using servlets and JDBC for access to relational databases.
This Java Servlet training develops the important concept of the separation of programmatic and declarative development: use of configuration and context information in lieu of hard-coded values, resource locations, etc., to make the web application as portable and easy to administer as possible. The course introduces JavaBeans as a standard for business and data objects that can be shared among servlets and JSPs, and develops techniques for sharing such objects at session scope or by request forwarding. Finally, students learn how to implement filters to adapt existing servlets by pre- and post-processing the request and response.
Java Servlets - course syllabus
Introduction to WorldWideWeb
Understanding static and Dynamic webpages
How to create a HelloWorld application using servlets
Servlet interface, Generic and HttpServlet interfaces
Annotation and Xml based configuration in Servlets
Difference between Get & Post
How Servlet works (Life cycle)
Load On Startup Configuration
Request Scope in Servlets
Interservlet communication using Response.sendRedirect
Session Tracking using cookies
Filters in servlets
Database connection in servlets
CRUD operations using servlets to mysql database
Events and Listeners in servlets
What you will learn in this Java Servlets course
Understand and appreciate the role of Java Servlets in the overall Java 2 Enterprise Edition architecture, and as the best Java solution to HTTP application development
Use request and response objects provided to a servlet to read CGI parameters and to produce an HTML response
Develop interactive web applications using HTML forms and servlets
Manage complex conversations with HTTP clients using session attributes
Understand the role of JDBC in Java persistence code, and use JDBC for persistence in servlet applications
Preserve portability and ease of administration for a servlet application by parameterizing servlet code, using initialization parameters, properties files, and JNDI
Use JavaBeans classes to share complex business data between components
Implement filters to adapt existing servlets with new features, and to maximize the decomposition of logic between vertical business functions and horizontal facilities
Understand and manage HTTP sessions in a web application
Create servlet filters and listeners
Write pages created with JavaServer Pages technology (JSP pages)
Create easy-to-maintain JSP pages using the Expression Language and theJSP Standard Tag Library (JSTL)
Use integrated development environments (IDEs) and application serversfor Java EE development and deployment
Write servlets using the Java programming language (Java servlets)
Java Servlets: Servlet Architecture
The Java Servlet architecture includes communication interface, protocol used, requirements of client and server, the programming with the languages and software involved. Basically, it performs the below-mentioned tasks.
First, it reads the explicit data sent by the clients (browsers). This data can include an HTML form on a Web page, an applet or a custom HTTP client program. It also reads implicit HTTP request data sent by the clients (browsers). This can include cookies, media types and compression schemes the browser understands, and so forth.
After that, the servlet processes the data and generate the results. This process may require communicating to a database, executing an RMI, invoking a Web service, or computing the response directly.
After processing, it sends the explicit data (i.e., the document) to the clients (browsers). This document can be sent in a variety of formats, including text (HTML or XML), binary (GIF images), or Excel formats.
Finally, it also sends the implicit HTTP response to the clients (browsers). This includes telling the browsers or other clients what type of document is being returned
Servlet Life Cycle
The Servlet life cycle mainly includes the following four stages,
Loading a Servlet
Initializing the Servlet
Destroying the Servlet
Java Servlets: Steps to Create Servlet
Create a directory structure
Create a Servlet
Compile the Servlet
Add mappings to the web.xml file
Start the server and deploy the project
Access the servlet