Eclipse J2EE IDE (I am using Eclipse Mars version)
JDK installed (I am using JDK 1.8 version)
Tomcat Server (I am using Tomcat 7.1 version)
1. Create a New Dynamic Web Project
- In Eclipse under Project Explorer Right Click -> New -> Dynamic Web Project.
- Enter Project name: HelloWorld
- Target Runtime: Apache Tomcat vX.X
- Click : Next -> Next
On Web Module Page Check "Generate web.xml deployment descriptor" -> Finish.
2. Creating JSP page :- Right Click on Project Folder HelloWorld -> New -> JSP File.
- Change File Name : index.jsp
- Click Finish
- Add the below lines in bold to your index.jsp page
index.jsp<%@page import="java.sql.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Hello World Program</title>
</head>
<body>
<%= "<h1>JSP : Hello World!!</h1> <br/> Today's DateTime : " %>
<%= new java.util.Date() %>
</body>
</html>
3. Creating Tomcat Server:
- Menu : Window -> Show View -> Servers
- Right Click in Servers tab: New -> Server
- Select the Tomcat Version that you have installed on your system.
- Click on link Add and link to the Tomcat installed location.
4. Running JSP HelloWolrd Project :Right Click on HelloWolrd Project -> Run As -> Run on Server
Run on Server: Click Next -> Finish.
Output :- Deep Dive into Java 8 Predicate Interface
- Read and Parse XML file using Java DOM Parser [Java Tutorial]
- Java 8 Predicate Functional Interface isEqual() Method Example
- Convert Multidimensional Array toString In Java
- How to read int value using Scanner Class Java
- Spring Boot AI + LLM + Java Code Example
- Write to a File using Java Stream API
- Implementing Bubble Sort Algorithm using Java Program
- How to Fix XmlBeanDefinitionStoreException in Java SpringBoot ApplicationConfig.xml
- YAML Parser using Java Jackson Library Example
- [Fix] java: integer number too large compilation error
- Convert JSON String to Java GSON Object Example
- Read a file using Java 8 Stream
- Java Spring Boot 3 Web Hello World with Gradle in IntelliJ
- Ways Compare Dates in Java Programming with Examples
- Pretty Print JSON String in Java Console Output
- Java JDBC with Join Queries Example
- How to Check For Updates on Windows 11 (Step-by-Step)
- [Fix] java.net.MalformedURLException: unknown protocol
- How to display date and time in GMT Timezone in Java
- Error: LinkageError occurred while loading main class UnsupportedClassVersionError [Eclipse Java]
- How to convert a String to Java 8 Stream of Char?
- RabbitMQ Queue Listener Java Spring Boot Code Example
- 5+ Fibonacci number Series Java Program Examples [ 0 1 1 2 3 ..]
- Handling NullPointerException with Java Predicate
- How to always fail a Junit Java Test Case - Java
- Add Line Break in Microsoft Excel Cell on Mac (macOS) - MacOS
- How to send email from JavaScript HTML using mailto - JavaScript
- Make div element draggable using jQuery - jQuery
- Fix - zsh: command not found: conda [macOS] - zsh
- How to remove blank lines from a file using Notepad++ - NotepadPlusPlus
- AlertDialog with image using ImageView Example - Android
- Download Google Chrome setup exe file using PowerShell - Powershell