- In Eclipse, select File > New > Dynamic Web Project.
Note: If you do not have an option to select Dynamic Web Project, select Help > Install New Software, and then select the following:
Eclipse Java EE Developer Tools
Eclipse Java Web Developer Tools
Eclipse Web Developer Tools
JST Server Adapters (this is needed to target the application for Tomcat, JBoss, WebSphere, et cetera)
JST Server Adapters Extensions (this is needed to target the application for Tomcat, JBoss, WebSphere, et cetera)
- Give your project a name, such as myApp. If you have setup a server in Eclipse, select the Target runtime. Select Next.
- At the Java prompt, select Next.
- Athe Web Module prompt, check Generate web.xml deployment descriptor, and select Finish.
- In the left panel of Eclipse, right-click on myApp and select New > JSP File.
- Select the WebContent folder, give the file a name such as index.jsp, and select Finish.
- The index.jsp file should now be listed under the WebContent folder in the left panel of Eclipse. Add the text Hello World to the index.jsp file.
Note: By naming the file index.jsp, there will be no need to modify the welcome-file-list section of the web.xml file, because there should also be a default document for index.jsp.
If you have added a server to Eclipse, you can also run the application in Eclipse. For example, if Tomcat has been added to Eclipse, select the green play button and select Run on Server.
Select your server and select Finish.
Your simple Hello World application should now be display in Eclipse.
If you have not added a server to Eclipse, export your application, and then deploy your application on an application server.