In this lesson, you will create a dynamic Web project that is enabled
for Struts.
Struts is a framework of open-source software designed for building
Web applications quickly and easily. Struts uses the model-view-controller
(MVC) design pattern of application development. The MVC design pattern makes
it easier to create and maintain complex Web applications by separating the
application into three parts:
- The Model maintains the data and the business logic in the application.
Since this tutorial does not use a database, and the only data is the data
that the user enters, there is no model in this tutorial.
- The View is the interface that displays information to the user. In this
tutorial, the view is the two Web pages that collect data from the user and
display results to the user.
- The Controller handles the events in the application. In this tutorial,
the controller is made up of an action mapping and a form bean which work
together to process the information that the user enters.
To create
a new Struts-based Web project:
- From the menu bar, click .
The New Project window opens.
- Expand Web and select Dynamic
Web Project, then click Next. The New
Dynamic Web Project wizard opens.
- In the Project name field type DayOfWeek.
- In the Target runtime field, select the
runtime you have configured, then click Next.
Note: If you have not configured a runtime server, click
New to
start the
New Server Runtime wizard. For this tutorial
you can use a WebSphere
® Application
Server 6.x, a WebSphere Application
Server 5.1 test environment or remote server, or an Apache Tomcat 5.x runtime
server. If you need help configuring a runtime, see
http://tomcat.apache.org/download-55.cgi.
- On the Project Facets page, click Struts,
then Next.
- Do not change anything on the Web Module page.
Click Next.
- Do not change anything on the Struts Settings page.
Click Finish.
- If you are not in the J2EE perspective, a message displays asking
if you want to open this perspective. Click Yes.
- If this is the first time you are creating a Web project, a confirmation
dialog displays asking if you want to enable certain capabilities needed for
Web projects. Click OK.
- A new Struts Web project is created and visible in the Project
Explorer view. A new Web diagram opens where you can visually edit and build
your Web projects.
Note: Select the Welcome to the Web Diagram Editor object on the Web
Diagram, then click Delete key to close Welcome.
A new Struts Web project
is created and visible in the Project Explorer view. A new Web diagram is
also created and open.