Category: J2EE

Deploy JAX-WS service on tomcat

This tutorial provides a step-by-step guide on how to build and deploy JAX-WS web service on Tomcat. Throughout this tutorial, we create a very simple SOAP web service and finally deploy it on Tomcat application server. Prerequisites: Eclipse IDE (Neon release) Java 1.8 Apache Tomcat 8 1. Create Maven web project Create a maven web project using this tutorial and name your...

Build SOAP service with JAX-WS

JAX-WS is an API used for building and consuming XML web services in Java, it was first released in Java EE5. In this tutorial, we provide a step-by-step guide on how to build SOAP web service with JAX-WS and finally publishing it using Endpoint built-in class. Prerequisites: Eclipse IDE (Neon release) Java 1.8 1. Create standalone Java project Open eclipse,...

Deploy Spring Boot application on external Tomcat

Spring Boot provides an embedded servlet container which makes it very easy to setup and deploy web applications, by default all Spring Boot applications are exported as a runnable jar file and developers would only need to run this jar file on a java environment without the need to worry about installing and setting up servlet containers. However, the embedded...

Introducing Spring Boot

Setting up an enterprise spring-based application has become a tedious and error-prone task due to the required bulky configuration along with the complicated dependency management especially if we’re talking about applications which make use of several third party libraries. Each time you build an enterprise spring-based application, you have to repeat the same configuration steps: Import the required spring modules...

Build REST web service using Spring

This tutorial provides a step-by-step guide on how to build REST web service using Spring framework. Prerequisites: Eclipse IDE (Mars release) Java 1.8 Apache tomcat 8  1. Create Maven web project Create a maven web project using this tutorial and name your project as SpringRestService. The structure of the generated project looks like the following: 2. Add Spring dependencies After creating...

Building REST web service using RESTEasy

RESTEasy is yet another popular framework which implements JAX-RS specification and is widely used for building REST web services in java. In this tutorial, we provide a step-by-step guide for building a REST web service using RESTEasy framework, we provide different ways to configure RESTEasy with both Servlet 3.0 and Servlet 2.0. If you’re interested in Jersey, check this tutorial. Prerequisites: Eclipse IDE...

Building REST web service using Jersey

Since Java 5, JAX-RS specification has been announced in order to support building REST web services according to the REST architectural pattern. JAX-RS is a set of interfaces or APIs which provides the building blocks for building REST services in java. Although you can’t build a fully functional RESTful service using these interfaces, there exists a lot of popular frameworks...

forward() vs sendRedirect() vs include()

It is a common practice that a controller redirects to another resource after processing a request, the resource could be either a view which displays the result of processing or even another controller which needs to do further processing on the request. In this tutorial, we explain the different ways of redirecting requests from servlet to another resource. Basically we...

Pass data from servlet to jsp

JSP is mostly used as the view component in any java-based MVC application, its main usage is to present dynamic data processed and generated from server-side controllers like servlet. In this tutorial, we explain the different ways of passing attributes/parameters from servlet to JSP, along with several examples specific for passing data types like: objects, arrays, lists and maps. 1....

Pass data from javascript to servlet

In modern web applications, the data exchange between front-end and back-end is usually done dynamically through javascript. In this tutorial, we explain 2 ways of exchanging data between javascript and java servlets, we also provide an example and business cases for the usage of each way. 1. Submit form programatically The first case is when you already have an html...