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 :
- How to get Java Thread name Example [Program]
- Java 8: Get First and Last Date of the Week for Given Date
- Convert String to int in Java
- How to Get List of All Country Codes in Java Using Locale Class
- Convert Multidimensional Array toString In Java
- [Fix] java: incompatible types: incompatible parameter types in lambda expression error
- Display Era details (AD BC) in Java Date using SimpleDateFormat
- Create a Zip file using Java Code programmatically
- [Fix] java.net.MalformedURLException: unknown protocol
- [fix] Java JDBC ConnectException: Connection refused
- Read Json File and Convert to Java Object using Jackson
- list of jars required for hibernate 4.x.x
- Simple Struts 2 Tutorial in eclipse with tomcat 7 server
- Java: The value of the local variable string is not used
- [fix] URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs) IntelliJ
- Java 8+ get Day of the Week Examples with LocalDateTime, DateTime, ZonalDateTime and Instant classes
- Run SQL Script file using Java JDBC Code Example
- Remove Trailing zeros BigDecimal Java
- Java JDBC IN Clause Example with PreparedStatement MySQL
- Convert Java List to Json String using Jackson
- Java 8 foreach loop code examples
- error: file not found: HelloWorld.java
- IntelliJ Keyboard Shortcut to remove unused imports [Java]
- Exception in thread main java.lang.NoClassDefFoundError: package javaClass
- Struts 2 Hello World Example in Eclipse
- Cannot start Android Studio. No JDK found - Android-Studio
- C#.Net error The underlying connection was closed: An unexpected error occurred on a send - SharePoint
- [fix] MySQL cj jdbc CommunicationsException: Communications link failure - Java
- [Fix] Java - Exception in thread main java.lang.IllegalThreadStateException - Java
- How to Close Safari in Mac using Keyboard shortcut - MacOS
- How to get query string in JavaScript HTML location.search - JavaScript
- How to know docker Engine details - Docker
- [Solution] AWS Java SDK S3 AmazonS3Exception InvalidAccessKeyId - AWS