Creating a Dynamic Web Project



Open New Project Wizard.

User Interface:

  Right click in the Package Explorer View.
  Select:		New > Project
  Select:		Web > Dynamic Web Project
  Click:		Next

Description:

This selection will cause WTP to create a project capable of holding Servlets, JSP pages, and HTML pages. These types of projects can be packaged and deployed in a WAR file or in an EAR file.


Create New Dynamic Web Project.

User Interface:

  Enter:		Project name:
  Select:		Target runtime: (from pull down list)
  Check:		Add project to an EAR and provide EAR Project Name: (Optional)
  Click:		Next

Description:

This dialog allows you to name the project and specify where in the file system the project should be created. You also have the ability in this dialog to specify that the project should be packaged for deployment in an EAR file. If this is not specified then the project will be deployed in a WAR file.

Description of fields:

Project name:
Enter the name you want the project known by in this text box. It is strongly recommended that you avoid using spaces in this name as that can cause problems on some platforms.

WARNING: Avoid using spaces in the project names!

Project Contents:
If you uncheck the Use default checkbox, then you can supply the location in the file system where you want this project to exist. The default location will be in the Eclipse workspace, under a directory name that matches the project name.

Target Runtime:
Select the WTP Server Runtime which will be used when this project is deployed. Selection of a server here only adds the JRE and the servers J2EE Jar files to the build classpath for this new project. It does not prevent the project from being deployed at a later time to other servers defined within WTP.

If there are no entries in the pull down list then you must create a server runtime to which this project can be associated. This can be accomplished by clicking on the New button to the right of this field.

Dynamic Web Module version:
J2EE Web Application specification version to use.

Configuration:
This list lets you choose which facet should be used with your project. A facet represents a collection of functionallity and when selected may enable builders to be run when the project is built. In this case a builder will be used to create server-specific content (both extra files and extra data within existing files) in the project.

EAR Membership:
If you check the Add project to an EAR checkbox, you can then enter the name of an EAR project in this text box. This will cause WTP to package the Dynamic Web Project in the specified EAR file for deployment when being published to a server. If an EAR project by the name entered in this text box does not exist then it will be created. If this option is not selected then this project will be packaged in an WAR file for deployment.


Specify Web Module Parameters.

User Interface:

  Click:		Finish

Description:

This dialog allows you to change the context root used to access this project after it has been deployed to a server. You may also change the default folder names used to store project information.

Description of fields:

Context Root:
This field identifies the web application to the application server when a request is received from a network browser. By default WTP will use the project name as the context root but you could change it by entering a value in this field.

Content Directory:
This field identifies the folder where HTML and JSP pages will be located in the Dynamic Web project. WTP will default this value to WebContent but you may change it to a different value. If you do change it then you must be aware that other references in this help documentation that refer to WebContent are really making reference to the value you entered into this field.

Java Source Directory:
This field identifies the folder where servlet source files will be created. WTP will default this value to src but you may change it to a different value.



Update the WebDoclet (XDoclet) Project Properties.

User Interface:

  Right click on the Dynamic Web Project in the Package Explorer View.
  Select:		Properties
  Select:		XDoclet
  Uncheck:	Use global xdoclet preferences
  Enter:		XDoclet Home: (if missing or incorrect)
  Enter:		Version: (if missing or incorrect)

Description:

This dialog controls the XDoclet builder that can be run when this project is built. It also is used to tell Eclipse where XDoclet has been installed on your system.

Description of fields:

XDoclet Home:
This field should point to the XDoclet installation on your system. In the folder this points to you should find folders named docs, lib, and samples.

Version:
This must identify the version of XDoclet installed on your system.

User Interface:

  Select:		XDoclet > webdoclet
  Check:		JOnAS Wtp Adapter
  Select:		JOnAS Wtp Adapter
  Click:		Edit

Description:

This dialog controls which tasks should be run during the WebDoclet phase of the project build. It is during the execution of these tasks that the server specific deployment descriptors (and other things) get created.

User Interface:

  Set:			Version to 2.6 (if missing or incorrect)
  Click:		Finish
  Click:		OK (to exit the properties dialog)

Description:

This dialog provides an interface to allow the user to edit some of the XDoclet properties associated with the JOnAS WebDoclet tasks. These tasks are run during the build of the project. The JOnAS Xdoclet Jar file delivered with this package includes version 2.6 of the JOnAS WebDoclet tasks. If you are using a different Xdoclet Jar file, then the version field may need to be changed to match the version you are using. The other fields in this dialog should probably not be changed.

Description of fields:

version
This field identifies the version of the WebDoclet tasks to be used during the project build. Its value should be set to 2.6 if you are using the JOnAS XDoclet JAR file delivered with this package. If you are using a different JAR file (we have not seen another one that works correctly) then this version must match the version of the tasks in that JAR file.

all other fields
Values in all other fields in this dialog should probably remain unchanged.



Create an HTML page in a Dynamic Web Project.

User Interface:

  Right click on the Dynamic Web Project in the Package Explorer View.
  Select:		New > Other
  Select:		Web > HTML
  Click:		Next

Description:

This selection will cause WTP to create an HTML page in the selected project.

User Interface:

  Expand the Dynamic Web Project.
  Select:		WebContent
  Enter:		File name:
  Click:		Next

Description:

This dialog allows you to name the HTML page and specify where in the Dynamic Web project the new HTML page will be created.

Description of fields:

Enter or select the parent folder:
This field identifies where the HTML page will get created. The user may just type in the location to put the page or use the selection method described above. In either case the text box should show <project name>/WebContent before proceeding on to the next dialog.

File name:
This field is the name of the HTML page to be created. The file name must end with a recognized suffix. A list of legal suffix values is provided in the heading of the dialog box when the provided suffix is not one of the supported values.

User Interface:

  Select:		HTML template (or uncheck Use HTML Template)
  Click:		Finish

Description:

This dialog allows you to specify a template to control the creation of the HTML page.



Create a JSP page in a Dynamic Web Project.

User Interface:

  Right click on the Dynamic Web Project in the Package Explorer View.
  Select:		New > Other
  Select:		Web > JSP
  Click:		Next

Description:

This selection will cause WTP to create an JSP page in the selected project.

User Interface:

  Expand the Dynamic Web Project.
  Select:		WebContent
  Enter:		File name:
  Click:		Next

Description:

This dialog allows you to name the JSP page and specify where in the Dynamic Web project the new JSP page will be created.

Description of fields:

Enter or select the parent folder:
This field identifies where the JSP page will get created. The user may just type in the location to put the page or use the selection method described above. In either case the text box should show <project name>/WebContent before proceeding on to the next dialog.

File name:
This field is the name of the JSP page to be created. The file name must end with a recognized suffix. A list of legal suffix values is provided in the heading of the dialog box when the provided suffix is not one of the supported values.

User Interface:

  Select:		JSP template (or uncheck Use JSP Template)
  Click:		Finish

Description:

This dialog allows you to specify a template to control the creation of the JSP page.



Create a Servlet in a Dynamic Web Project.

User Interface:

  Right click on the Dynamic Web Project in the Package Explorer View.
  Select:		New > Other
  Select:		Web > Servlet
  Click:		Next

Description:

This selection will cause WTP to create a servlet in the selected project.

User Interface:

  Enter:		Java Package:
  Enter:		Class name:
  Click:		Next

Description:

This dialog provides a way to specify which project and where in the project the new servlet should be created.

Description of fields:

Project:
Must be set to the name of a Dynamic Web project that is to contain the new servlet being created. If the desired project was selected before the new servlet wizard was started, then its name should already be present in this field. If it was not selected, Eclipse will try to pick a Dynamic Web project from your workspace but it may not be the one you want so you may have to change it.

Folder:
This is the folder that will be used to put the source for the new servlet that is being created. The value supplied for this field should match the Java source directory value used when the Dynamic Web project was created.

Java Package:
This specifies the package name used by the servlet. These values typically start with a lower case character and should be a qualified name that makes them unique to your organization (eg: org.ow2.xyz). If this package does not already exist it will be created.

Class name:
This specifies the Java Class that will be generated to implement the servlet. The value entered here will also be offered as the default value for the servlet Name in the next dialog.

Superclass:
This specifies the class that this new servlet implements. By default WTP will offer the value of javax.servlet.http.HttpServlet.

Use existing Servlet class or JSP
Whether to use another Servlet or JSP (for example, for rendering purposes).

User Interface:

  Click:		Next

Description:

This dialog provides you a place to specify values that will be used to create application server deployment descriptors.

Description of fields:

Name
The name to be used to identify this servlet in the deployment descriptors used by application servers when this EJB is loaded. By default WTP will offer the class name value specified in the previous dialog.

Description
A breif description of the services provided by the servlet. This value will appear in the web.xml file but does not appear to be used at runtime.

Initialization Parameters:
Normally empty, unsure when you would need to use this.

URL Mappings:
This identifies the URL strings which should be mapped to this servlet. When a request arrives from the network browser which contains one of these URL strings, the request will be routed to this servlet. This information is recorded in the web.xml file.

User Interface:

  Click:		Finish

Description:

This dialog provides the ability to customize the generated servlet. You can control the interfaces which the servlet will implement as well as which method stubs should get generated.