Sunday, March 17, 2024

Top 22 Apache Tomcat Interview Questions Answers for Java JEE Developers

The Apache Tomcat is one of the most popular web server used to deploy Java web application comprising HTML, JavaScript, Servlet and JSP. If you have ever worked in a Java web application you might have found yourself using Tomcat everywhere, from test environment to production. It is the defacto standard for deploying Java Web applications without EJB because using application server like WebSphere or WebLogic is both costly and superfluous for such web application. As a Java developer, working in Java and Spring based web applications, you should know some basic and advanced detail of Tomcat server to efficiently support your Java web app and troubleshoot any issue arising on request processing. 

Saturday, July 8, 2023

Apach FreeMarker HelloWorld Tutorial and Example in Java

Apache FreeMarker is a free, open source, Java based template engine which allow you to create dynamic content by combining the static template with dynamic data. The template is written in their own proprietary language called FTL(FreeMarker Template language), which is like any scripting language which allows you to insert variables, looping constructs and conditional logic. FreeMarker is often used with JSP in MVC based Java application to generate dynamic content but it's not limited to Servlet or JSP and you can use with core Java as well. In fact, this FreeMarker Hello World Example is without JSP. We generate a dynamic HTML file by using Freemarker in the main() method itself. Apache FreeMarker is often used for generating source code, configuration files or personalised e-mails.

Saturday, April 22, 2023

Difference between Filter and Listener in Servlet - Java JEE

One of the frequently asked Servlet Interview question is what is the real difference between a Filter and a Listener? What is the role they play in a Java web application? In this article, I'll try to answer these question by explain what is Servlet Filter and Servlet Listener and what are their use in Java web application. A filter is used for pre-processing and post-processing. It can intercept the request before it hits to the servlet and can modify both header and body of Servlet, hence it is used to perform login, authentication, authorization and other security aspect which is require before client can access the resource e.g. a Servlet or JSP. Similarly, filters can also intercept the response and modify both header and body of response, hence you can use it both compress and encrypt the response before sending it to the client.