Magazine
 
Struts 1.1

This tutorial provides you a better understanding to develop a robust application using Jakarta Struts Framework. Before starting we are considering that you have an idea about developing a web application by using JSP, Servlets, JDBC and custom tags. So let’s from
the Jakarta Struts Framework.

Struts

Struts Frame is nothing but the implementation of Model-View-Controller (MVC) design pattern. Struts is an open source framework and maintained as a part of Apache Jakarta project. Struts Framework suits to develop any size of application. You can down the latest version of
struts from http://jakarta.apache.org/. We are using jakarta-struts-1.1 and jakarta-tomcat- 5.0.4 for this application. Before going to start lets first take a brief introduction about MVC architecture.

Model-View-Controller (MVC) Architecture

Model-View-Controller architecture separates the application components into three different parts named Model, View and the Controller. Each component of the MVC architecture is independent with the other and also has unique responsibility. Changes made to one component have less or no impact on other component.
Here is description about the responsibilities of the components of MVC architecture:

Model: This part of the MVC architecture provides access to the data from the database and also saves the data into the database. Model includes the business logic of the application. Model part also checks the Data send by the user through View before saving it into the
database. Data access, Data validation and the data saving logic are also part of Model.

View: View part of the MVC architecture handle the view part of the application by taking the input from the user, dispatching the request to the controller and receiving response from the controller and displaying the result to the user. HTML, JSPs, Custom Tag Libraries and
Resources files are used as part of view component.


 

Controller: Controller part controls the flow of the entire application. It interacts with Model and View and the works as Intermediary between these two components of the MVC architecture. Controller also receives the request from client process that request by executing
the appropriate business logic of the Model and then sends the response to the user using the View component. Controller part includes ActionServlet, Action, ActionForm and strutsconfig. xml as its parts.

Setting Up Development Environment

Before going to start first of all we have to setup the development environment for the application.

JDK Installation:

Download JDK 1.4 or above from sun site. Follow the instruction given in the installation process to install JDK on your machine.

Tomcat Installation:

Download the binary version of Tomcat from the apache site and follow the instruction to install the tomcat on your machine. For this application we have downloaded jakarta-tomcat- 5.0.4. After successfully completion of the
installation process test your installation. To test the installation, go to your installation directory/bin and issue startup command to run the server. Open the browser and type http:/ /localhost:8080/ . If it is successfully installed it should display the welcome page, If not consult tomcat documentation before going further.

Installing Struts Application:

Download any version of Struts1 from the site of Struts http://jakarta.apache.org/struts. Extract file into the desired directory and then copy struts-blank.war, struts
documentation.war and struts-example.war from “jakarta-struts-1.1\webapps” directtory into “jakarta-tomcat- 5.0.4\webapps” directory.

struts-blank.war is a blank struts application which is useful in creating struts application from scratch. We are using this file to create our

Mar 2008 | Java Jazz Up |24
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59,

Download PDF