In this blog you will learn to create web project from scratch
Generate web.xml deployment descriptor
Give name as myFirst.jsp and click on finish
Add the content to myFirst.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>My First Application</title>
</head>
<body>
Welcome to My first application
</body>
</html>
Step 1 - Creating Dynamic web project In Eclipse
Right Click in Project Explorer and select
New --> Dynamic Web Project
Step 2 - Name the Project
Name the project as MyFirstApp. click on next and on last page selectGenerate web.xml deployment descriptor
Step 3 - Add myFirst.jsp
Right-click on project MyFirstApp and create jsp as shown
Add the content to myFirst.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>My First Application</title>
</head>
<body>
Welcome to My first application
</body>
</html>
Step 4 - Edit content of web.xml
Open webContent --> web.xml
Add myFirst.jsp in welcome file list
Add myFirst.jsp in welcome file list
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>MyFirstApp</display-name>
<welcome-file-list>
<welcome-file>myFirst.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>