Skip to content

Dynamic

Eclipse provides the Dynamic Web Project template for creating projects. * A Dynamic Web Project can run on Eclipse's Tomcat server.

This project has a different structure than a Java Project.

Project Structure

  • Java Resources/src - location of Java code.

  • src/main/webapp/ - document root, where Tomcat looks for files.

  • src/main/webapp/WEB-INF/ - location of web.xml; directory is not available outside web container.

Creating a Dynamic Web Project.

Creating a Dynamic Web Project is much like creating a Java Project, with additional configuration steps.

  • File->New->Dynamic Web Project. (You may have to select Other and search for this type.)

Dynamic Web Project

  • Give the project a name.

Dynamic Web Project

  • Use default settings:
  • Project location: use default location.
  • Dynamic web module version: 3.1.
  • Target runtime: <none>.
  • Configuration: <custom> or Default Configuration.

Select Next > to move to another configuration screen.

  • Leave the source folder for Java classes as src, and select Next.

src

  • Leave the content directory as src/main/webapp, and select Generate web.xml deployment descriptor. This creates the web.xml file.

Generate deployment descriptor

Select Finish.

Drill

Create a new Dynamic Web Project called MyHelloWorld. We will add to this project throughout the chapter.


Prev -- Up -- Next