Monday, August 25, 2014

Create Dynamic web project Hello World Eclipse

Create Dynamic web project Hello World Eclipse

This demo shows how to create dynamic web project Hello World in Eclipse.
  • Download eclipse from http://www.eclipse.org/downloads/ site. I have used eclipse (Version: Helios Service Release 2)for demo.
  • Open you eclipse
  • Click File –> New –> Dynamic Web Project
Create Dynamic web project Hello World Eclipse
  • It opens New Dynamic Web Project window. Please enter you dynamic project name in Project name and leave all value selected default. Below are descriptions:
    • Project Location: You could choose default location as your workspace location otherwise you could choose any location
    • Target runtime: Here you will Apache Tomcat v7.0 which is selected by default because tomcat is already configured before in eclipse. Please follow this link Configure and Run Tomcat server in eclipse if you want to do so.
    • Dynamic web module version: Version 3.0 selected default because that is latest version in demo eclipse. You could change version based on you need from drop down.
    • Configuration: Default selected Apache Tomcat v7.0 (Please follow Configure and Run Tomcat server in eclipse if you want to configure it)
    • All below are selected by default. We don’t need to anything on that.
  • Click Next
Create Dynamic web project Hello World Eclipse
  • You will below window leave all value selected default and click Next
Create Dynamic web project Hello World Eclipse
  • In next window
    • Context root: This is beginning root of your project to run on the server
    • Content directory: Default is WebContent to keep all your client side view files
    • Please check the box Generate web.xml file to generate automatically
Create Dynamic web project Hello World Eclipse
  • Click Finish. Now you will see new Dynamic Web project in eclipse window
Create Dynamic web project Hello World Eclipse
  • Now create index.jsp inside WebContent folder and copy paste below content in it:
<%@ 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>Dynamic web project</title>
</head>
<body>
Hello world!
</body>
</html>
  • Your folder structure should look like below:
Create Dynamic web project Hello World Eclipse
  • Now right click your project select Run As –> Run on Server
Create Dynamic web project Hello World Eclipse
  • After click Run on Server you should see below:
Create Dynamic web project Hello World Eclipse



ref: http://javahonk.com/create-dynamic-web-project-hello-world-eclipse/


No comments:

Post a Comment