This article discusses the JSTL Tags for Decision Making and Loop. Basically, in Java, we have if and switch…case statements for decision making. Likewise, we have for loop, while loop, and do..while loop in Java. JSP Tag Library (JSTL) provides several tags for decision-making and loops. While, the c:if tag works like an if statement …
More JSTL Examples
This article contains some more JSTL Examples. To begin with, the three tags that provide the functionality of the switch…case statement in Java are discussed. c:choose Tag Basically this tag work like the switch…case statement in Java and provides a mutually exclusive conditional operations. c:when Tag Likewise, the c:when tag works as a Case statement in switch….case statement of Java. Therefore, witin the c:choose tag, …
When and How to Use JSTL Tags
In this article, I will explain When and How to Use JSTL Tags. Basically, we can use JSTL tags in place of the scriptlet. When to Use JSTL Tags? In general, we use the JSP Tag library in the following situations. For the purpose of reducing the number of lines of code, the corresponding JSTL …
A Login Application using JSP, Servlet, and JDBC
The following example shows A Login Application using JSP, Servlet, and JDBC. Specifically, the Login.jsp file creates a client-side form that allows users to enter their credentials. Once, the user enters data and clicks on the Submit button, the LoginServlet executes. Furthermore, the database table used here is named myusers. The following figure shows the data stored in this table. …
Example of Servlet and JDBC Connectivity
This example explains Servlet and JDBC Connectivity with a MySQL database. As can be seen in the output, this example shows a list of users which it fetches from a database table. Further, we use MySQL Workbench 8.0 CE for creating our database. Creating Database Table To begin with, we create a database called d1. Further, we use the <use …
When and How to Use Servlet Annotations
In this article, I will explain When and How to Use Servlet Annotations. In fact, the Servlet version 3.0 introduces the concept of annotations. As a result, it is no longer required to use only the web.xml file for configuring the servlets. Hence, we have now annotations to configure various components of the servlet. Accordingly, IDEs like …
Creating Deployment Descriptor in a Dynamic Web Project
This article explains Creating Deployment Descriptor in a Dynamic Web Project in Eclipse JEE. Basically, a deployment descriptor is called web.xml and contains configuration information regarding a dynamic web application. However, when we create a dynamic web project in Eclipse IDE, the web.xml file is not available by default. Therefore, we need to create this …
Registering a Servlet in Deployment Descriptor
This article explains Registering a Servlet in Deployment Descriptor. Basically, registering a servlet in the deployment descriptor requires providing the <servlet> tag in the web.xml file. Also, within this tag, the <servlet-name>, and <servlet-class> tags specify the name of servlet and associated java class respectively. Additionally, we can also specify <init-parameter> tags to provide the …
Understanding Deployment Descriptor
Basically, a deployment descriptor refers to a configuration file in a web application. Whenever we create a J2EE application, it includes web components comprising of servlets and JSP files, For the purpose of managing the dynamic web application, we can create a web.xml file. In fact, the web.xml is our deployment descriptor. This web.xml file contains information …
Servlet and its Life Cycle
In this article, I will explain Servlet and its Life Cycle. To begin with, let us first understand what a servlet is. What is a Java Servlet? In fact, the java servlet is a technology to create dynamic web pages. In short, servlets are classes that reside on a web server or application server. Furthermore, a …