Servlet Annotation WebServlet Example

The first example is to show Servlet Welcome using Servlet Annotation WebServlet. For this we have created an index.html page on index.html we have created a link. On clicking on link it will call welcome servlet. Our project directory structure is as per below index.jsp

Show welcome servlet

Welcome.java

Servlet Welcome

Read more

ServletConfig to access multiple initial parameter value

ServletConfig is ued to configure the servlet. We can configure values in the ServletConfig object and can access them later on. There can one or more values can be stored. ServletConfig stores values in key values pair. ServletConfig to access initial parameter value All values are stored in key-value pairs in <servlet> the tag in … Read more

Java Servlet Response JSON in JSP using Gson

In Modern web applications, We get data from the server in JSON format and display data in JSP or HTML page using Front end library or frameworks like Angular, React, etc. This is similar to mobile app development. Here we will see how we can get JSON Response from the servlet and show it in … Read more