Step by Step guide for Hello World Page (HTML and JSP)
This post is a step by step guide to develop hello world page (html and jsp). Traditionally, developers code ‘Hello World !!!’ as first page and I am sticking to this tradition.
I am using a Eclipse IDE and Apache Tomcat for this tutorial. I recommend going through ‘Step by Step guide to configure Eclipse and Apache Tomcat‘ before you proceed any further.
Step-1: Create Dynamic Web Application
Create a new Dynamic Web Project by clicking on FIle -> New -> Dynamic Web Project
Give a project name and click on Finish.
Step-2: Create a HTML page
Create a new html page by right clicking on WebContent and selecting New -> HTML File.
Put in a filename helloWorld.html and click on Finish.
Put in this code in helloWorld.html.
Hello World – html
Step-3: Create a JSP page
Create a new jsp page by right clicking on WEB-INF and selecting New -> JSP File.
Put in a filename helloWorld.jsp and click on Finish.
You are seeing any compilation errors then make sure that you have right Runtimes checked as shown below.
Put in below code into the jsp.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
Hello World – jsp
Step-4: Add Project to Server.
Add Project server to Server.
Step-5: Access new pages.
Access html page by url in browser. Url will be in “http://localhost:<port>/HelloWorld/helloWorld.html” format
Access jsp page by url in browser. Url will be in “http://localhost:<port>/HelloWorld/helloWorld.jsp” format