Struts Basic Tutorials,Struts Basic Tutorials with Examples
An Introduction to Struts 1.3 Frameworks
Apache Struts 1.3 is the most famous, classic and Model-View-Controller (MVC) web application framework. As we said earlier, Struts 2 is nít just a new release of the older Struts 1 framework. A web application can interact with different databases and business logic.
There are hundreds of thousand companies are implemented and used Struts 1.3 and never consider upgrade.
History of Struts Frameworks
Struts was created by "Craig McClanahan
" than it was donated to the Apache Software Foundation in May, 2000. Now struts is an open source code sponsored by Apache Software Foundation in 2005. This open-source web application framework provide the facility to developed dynamic web application in java enterprise edition. This web application framework extends the Java Servlet API which are using the concept of MVC(Model View Controller) pattern.
Different views on Struts Frameworks
There are different views by developers for Struts1.3 Frameworks.Struts 1.3 is one of the most used frameworks in Java/J2EE web based enterprise applications. Struts 1.3 is the most famous, classic framework.
Advantages of Struts Frameworks
Struts1.3 is a Frameworks which is an implementation of MVC-2 at server side. Struts1.3 have many advantages over the standard servlet and JSP API alone.
Disadvantages of Struts Frameworks
Struts1.3 have several advantages but also have some disadvantages.Struts is not easy to learn .struts1.3 is complex framework and it is used for large project only.so Struts2 have many disadvantages.
Why we need Struts Frameworks
As we have JSP and Servlet then what is need of Struts1.3? Struts1.3 have many more benefits rather than it is server side MVC-2 implementation .So that today struts is used into web based enterprise applications. Today Struts1.3 is used with Spring and Hibernate to make our web based application secure and faster. Today Struts1.3 used in project for telecom, e-Learning and banking/finance domain etc.
Where we use Struts Frameworks
Jakarta Struts is incredibly useful in helping you to create excellent Web applications because Struts uses a specific paradigm, or design pattern, to structure any application and the design pattern is called Model-View-Controller (MVC). So, struts framework is widely used and widely adapted.
The Model-View-Controller (MVC) Design Pattern
Struts1.3 framework implementation of Model-View-Controller (MVC) design patterns in JSP web applications, which offers many benefits to the web application developer. The MVC Model 2 paradigm applied to web applications lets you separate Presentation logic (for example, HTML and Custom Tag libraries) from Workflow control logic (Filter Dispatcher) and model logic( Action Class).
Types Model-View-Controller ('MVC') Design Pattern
MVC play biggest role in struts1.3 framework because MVC separates design concerns (data persistence and behavior, presentation, and control), centralizing control, decreasing code duplication, and making the application more easily modifiable.
Struts and Model-View-Controller (MVC) Design Pattern
Struts1.3 Frameworks is used to build Java-based Web applications. Struts solved many problems associated with developing high-performance, business-oriented Web applications that was in Servlets and Java Server Pages (JSP) by using the Model-View-Controller -2 (MVC-2) design patterns
The Model:- System State & Business Logic JavaBeans
A model represents appication's data and state and contains the business logic for accessing and manipulating that data.where data that is part of the persistent state of the application. ActionForm bean represents the Model state and not at a persistent level.The controller can accessed model services effecting a change in the model state.The model notifies the view when a state change occurs in the model.
The View: -JSP Pages & Presentation Components
JavaServer Pages (JSP) technology is used to make the View portion of a Struts-based application.
View serves as the screen representation of the model .It present the current state of the data object.
The Controller: ActionServlet and ActionMapping
The controller's main job is to map requests to action i.e. the controller is the first component to act in the processing. So, controller function as a backbone for
a struts based application. Struts have Action class and ActionServlet class which is used as controller. Controller servlet is most core of a Struts based application.
Getting Started a Struts Frameworks application
This chapter is a tutorial that covers getting started with Struts just the basics, nothing more, nothing less. This tutorial assumes knowledge of Java, JDBC, Servlets,J2EE (with regards to Web applications) and JSP. Although you can follow along if you are not an expert in all of the above, some knowledge of each is assumed.
Pre-requirement for struts applications
Downloading and configuring Struts
The minimum requirements for Struts applications are jdk, a web server(like tomcat and GlassFish Server) and the Jars of the Struts Frameworks. Then you need to install jdk and server and then configure the JDK, web server like tomcat and GlassFish Server and struts frameworks. Here you will learn from where you can download? and how you can configure it?
Welcome Program using Struts
This is basic examples of how you can make a struts application. Here we are going to make only View using JSP Struts Tag Library files. The purpose of this topic is taught you how you can make, run and debug struts application?
What is directory structure of struts framework application?
The directory structure of a struts application is same as dynamic web application's.The struts has one more xml file to configure ActionServelet, ActionForms, Actions etc. Struts also added two other xml file(optional) to validate the data entered by users. Struts use resources files to implements I18N in our application.
Set up a J2EE Web Application Project That Uses Struts Frameworks
J2EE Web Application Project is dynamic web project. It is combination of Java, Servelet, JSP and Static Web Recourses(like html, css, images, etc ). In J2EE only one xml is required. That is deployment descriptor file (e.g. web.xml).This deployment descriptor file is used to define all configuration of the J2EE web based application like welcome file, securities, tag lib ,Servelet configurations and Servelet mapping etc.
Setting up Struts applications
Here we are going to cover how you can Set Up a Struts Application. We are cover pre-requirements, from where you can download, how you can install and configure?
Adding Struts to an existing Web application
You can add Struts Frameworks into your existing Web based Projects. Struts have very easy steps to add struts into existing web projects.
Accessing Struts Frameworks documentation
As we know Struts Frameworks is sponsored by Apache Foundation. Apache Foundation provides documentations for all versions for developers help. With the help of theses documents developers would work on Struts Based Application.
Write A First Input View (JSP Page)
In this section we are going to create a First Input View using Struts Framework. We are creating here first login form using Struts Framework. So that the user can submit user name and password.
Write A Login ActionForm
You had made a struts Input JSP View in previous section. To gather data from struts Input View Struts Frameworks provides org.apache.struts.action.ActionForm class.
With by use this class we have to create a subclass which used to gather all data coming from input view.Here In this subclass, We can validate data input form (we will discuss it later) and also define reset method.
Write A Login Action class
When the request comes from client then ActionServet calls an Actions class which is subclass of org.apache.struts.action.Action
We have to override the execute() method.
R4R Struts Struts BasicCore Struts Basic Tutorial
Struts Basic Tutorials,Struts Basic Tutorials with Examples