- Introduction to the Servlet API, Web Server and Servlet Container
- Introduction to .war Packaging and Maven
- Quick Overview of Basic Maven Concepts
- How to Create .war Files with Maven Archetypes and Deploy to Tomcat
- How to Create .war Files with IntelliJ and Deploy to Tomcat
Books
▼
Friday, July 31, 2015
Introduction to Spring Boot as a Servlet Based Web Application Framework
This is the fifth and last post in the series on Introduction to servlet based web application in java. The previous posts in this series are:
How to Create .war Files with IntelliJ and Deploy to Tomcat
This post is the fourth post in the series of post on Introduction to Servlet based web application development in Java.
Previous post shows how to create Maven projects, package and deploy to either a standalone server or an embedded server, by directly using the Maven archetype; but since in practice, an IDE would be used for development, this post shows how to do the same using an IDE.
Intellij IDEA is used in this post. If using other IDEA (say Eclipse or NetBeans) you would have to consult the help section or online documentation for the corresponding steps in the IDE you use.
This post is adapted from Developing a Java EE application. A post which shows how to create and run a JEE web application, but it does not accomplish this with Maven and uses Glassfish as the application server instead of Tomcat which we are interested in.
What this post does is to modify the steps to include usage of Maven and then show steps on how to deploy to Tomcat
Previous post shows how to create Maven projects, package and deploy to either a standalone server or an embedded server, by directly using the Maven archetype; but since in practice, an IDE would be used for development, this post shows how to do the same using an IDE.
Intellij IDEA is used in this post. If using other IDEA (say Eclipse or NetBeans) you would have to consult the help section or online documentation for the corresponding steps in the IDE you use.
This post is adapted from Developing a Java EE application. A post which shows how to create and run a JEE web application, but it does not accomplish this with Maven and uses Glassfish as the application server instead of Tomcat which we are interested in.
What this post does is to modify the steps to include usage of Maven and then show steps on how to deploy to Tomcat
How to Create .war Files with Maven Archetypes and Deploy to Tomcat
Maven Archetypes are project templating mechanism, implemented as a Maven plugin.Archetypes make it possible to define the barebone of a project’s structure and then use that to create other projects.
This post, which is the fourth in a series of posts on Servlet based web application development in Java, shows how Maven archetypes can be used to generate a Web application Maven project; how to edit it to print “hello world”; and also, how you can use Maven to package it up so it can be deployed to a Servlet container.
We would make use of two Maven archetypes to achieve this:
1. The maven-archetype-webapp and
2. The Servlet3-maven-archetype
Let's get down to business
This post, which is the fourth in a series of posts on Servlet based web application development in Java, shows how Maven archetypes can be used to generate a Web application Maven project; how to edit it to print “hello world”; and also, how you can use Maven to package it up so it can be deployed to a Servlet container.
We would make use of two Maven archetypes to achieve this:
1. The maven-archetype-webapp and
2. The Servlet3-maven-archetype
Let's get down to business
Quick Overview of Basic Maven Concepts
This post is the third in the series of posts that Introduces Servlet based web application development in Java. It would be an overview of Maven and it serves to provide the necessary basic information about Maven before we proceed to other post in the series that touches on how to use Maven to package .war files and to use archetypes to create and deploy a .war to Tomcat.
An in depth coverage of these Maven concepts or Maven capabilities in general is not something that can be covered in a single blogpost; what this post does then is to only touch on some of the concepts, especially the ones that would help in making sense of the topics that will be addressed further on in this series of post.
An in depth coverage of these Maven concepts or Maven capabilities in general is not something that can be covered in a single blogpost; what this post does then is to only touch on some of the concepts, especially the ones that would help in making sense of the topics that will be addressed further on in this series of post.
Introduction to .war Packaging and Maven
The .war (Web application ARchive) is a packaging mechanism for putting together the application code of a web application to be deployed to a Servlet container. It is nothing complex and can be considered similar to ZIP files, the only difference being that it contains java related meta files that distinguishes it from regular ZIP files.
And just like ZIP files package up directory structures and their contents, .war files also do the same, the only difference being that the directory structures has to be laid out in a particular format.
This post is the second in a series of posts on Servlet based web application development in Java. It will thus introduce .war files, their structure and how to create one using Maven.
Introduction to the Servlet API, Web Server and Servlet Container
This post is the first in a series of posts on Servlet based web application development in Java. It will introduce the Servlet API and Servlet Containers.
Let's get to it...
Okay so you want to build a web application using Java? But as everyone knows, a web application needs to be hosted by a web server right? Right!
So maybe you can use the Apache HTTP Server or Microsoft Internet Information Services (IIS)...?
No.
No? But they are both web servers, aren't they?
True they are web servers, but remember we are going to be building Servlet based web applications? That means we need a web server that can, not only functions as an HTTP web server, but one that also serve as a Servlet container and can execute code written against the Servlet API...
"Servlet API? One that can serve as a Servlet container"? What does these mean?
Let us attempt an explanation…
Let's get to it...
Okay so you want to build a web application using Java? But as everyone knows, a web application needs to be hosted by a web server right? Right!
So maybe you can use the Apache HTTP Server or Microsoft Internet Information Services (IIS)...?
No.
No? But they are both web servers, aren't they?
True they are web servers, but remember we are going to be building Servlet based web applications? That means we need a web server that can, not only functions as an HTTP web server, but one that also serve as a Servlet container and can execute code written against the Servlet API...
"Servlet API? One that can serve as a Servlet container"? What does these mean?
Let us attempt an explanation…
Introduction to Servlet Based Web Application Development In Java
This post is the first in a series of post that introduces Servlet based web application development in Java.
It does not seek to be an exhaustive guide to a topic that is obviously broad and encompassing. That being said, the reader who is just approaching Servlet based web development for the first time should find the series of posts helpful.
Also, at appropriate junctions, I will provide links to resources where more in depth information can be found.
It is also worth pointing out that the reason we have the title as "Servlet based web application in Java", instead of just "web application in Java" is to stress the fact that using Servlet is just one option (albeit currently the most ubiquitous option) to building web applications with Java. It is possible to build web applications without using the Servlet API. Play Framework is an example of a framework that allows exactly that; Vertx is another example.
The posts contained in the series includes:
Introduction to the Servlet API, Web Server and Servlet Container
Introduction to .war Packaging and Maven
Quick Overview of Basic Maven Concepts
How to Create .war Files with Maven Archetypes and Deploy to Tomcat
How to Create .war Files with IntelliJ and Deploy to Tomcat
Introduction to Spring Boot as a Servlet Based Web Application Framework
Hopefully these series of posts help build the basic foundational knowledge of how servlet based web application works.
The Goal
The aim is to help the reader, quickly create a mental model for Servlet based web application development in Java: build an appreciation for the essential moving parts and a basic understanding of how they all fit together.It does not seek to be an exhaustive guide to a topic that is obviously broad and encompassing. That being said, the reader who is just approaching Servlet based web development for the first time should find the series of posts helpful.
Also, at appropriate junctions, I will provide links to resources where more in depth information can be found.
It is also worth pointing out that the reason we have the title as "Servlet based web application in Java", instead of just "web application in Java" is to stress the fact that using Servlet is just one option (albeit currently the most ubiquitous option) to building web applications with Java. It is possible to build web applications without using the Servlet API. Play Framework is an example of a framework that allows exactly that; Vertx is another example.
The posts contained in the series includes:
Introduction to the Servlet API, Web Server and Servlet Container
Introduction to .war Packaging and Maven
Quick Overview of Basic Maven Concepts
How to Create .war Files with Maven Archetypes and Deploy to Tomcat
How to Create .war Files with IntelliJ and Deploy to Tomcat
Introduction to Spring Boot as a Servlet Based Web Application Framework
Hopefully these series of posts help build the basic foundational knowledge of how servlet based web application works.