Tutorial on Struts Configuration

Struts, the open-source framework from Apache, offers integration with Java Beans and Java Server pages to provide a model-view-controller design pattern. Struts provides libraries of tags to work with the data model and action classes to work with the controller logic. The main purpose of Struts is to serve as the controller aspect of this design, while Java Beans connects with the database and JSP works to control the display of Web pages for the view.

Instructions

    • 1

      Open the "struts-config.xml" file in a text edition or through your IDE (integrated development environment) program. The file contains five main parts needed for Struts to work: form beans, global forwards, action mapping, controller configurations and application resources.

    • 2

      Add the name of each ActionForm within the "<form-beans>" tags. Each form bean should have the syntax <form-bean name="form_name"

      type="myclass.example.form_name"/> with "form_name" describing the name of the form and "myclass.example" describing the path to the Java package.

    • 3

      Add the pages that Struts should redirect to between the "<global-forwards> tags. File that end in ".do" serve as the connection between the Struts controller and the application. Files that end in ".jsp" are the Java Server page files that process the form. Global forwards should have the syntax "<forward name="action1" path="/action1.jsp"/>. "

    • 4

      Create action mappings to connect form beans to global forwards using the "<action-mappings>" section. Action mappings should have the syntax "<action path="/pathtoaction" type="myclass.example.form_name"

      name="form_name" scope="request" validate="true" input="/form_logic.jsp"> <forward name="success" path="/confirmation_page.jsp" redirect="true" /> <forward name="failure" path="/try_again.jsp" /> </action>."

      This example connects two forwards to the form, one for a successful completion and one for a failed entry.

    • 5

      Create the controller with the extended controller tag of "<controller

      processorClass="org.apache.struts.action.RequestProcessor" />."

    • 6

      Enter the parameters in the message resources section. Add "<message-resources parameter="myclass.ApplicationResources"/> if it is not already there. "Myclass" represents the Java package name.

Related Searches:

References

Comments

You May Also Like

  • JSP Web Tutorial

    JavaServer Pages (JSP) is a technology that allows you to create dynamic web pages by embedding Java programming language code in your...

  • Apache Struts Tutorial

    Apache Struts serves as a design pattern for JSP (Java server pages) on Apache servers. It operates on the model-view-controller principle, where...

  • How to Upload Files Using Struts

    Using the Struts framework, the development of key features of a website can be created and deployed in a shorter time. File...

  • How to Upload an Image in Struts

    Struts are programming methods that allow users to complete simple tasks, such as uploading and downloading files. It is used as a...

  • Struts Basics Tutorial

    There are many web applications offering a dynamic web experience as a result of client-server web-based programming languages. For example, the JavaServer...

  • What Are Shocks and Struts, and How Do They Work?

    Shocks and struts in a car are designed to absorb and dampen the feedback from the road, including bumps, potholes and dips...

  • The Purpose of a Strut Brace

    When cars turn, the unbraced chassis is flexed. This weakens the chassis, and it changes the car's handling characteristics. The chassis "strut...

  • Struts Tutorial for Beginners

    Struts is a framework to develop applications from scratch, for use in the J2EE (Java 2 Enterprise Edition) environment. Struts is a...

  • Types of Actionforms in Struts

    Types of Actionforms in Struts. According to IBM, as strut is an open-source framework that is used to create various applications on...

  • Struts HTML Tags Tutorial

    The Struts framework implements the pattern of Model-View-Controller (MVC) for Java Server Pages or JSP. The MVC pattern allows developers to separate...

  • Java Struts Tutorial

    Java Struts is the application framework developed by Sun Microsystems in order to dynamically deliver web pages to the end user. The...

  • How to Use Logic Iterate in Struts

    The "Logic Iterate" tag used in Struts is a tag that returns information. By specifying a section to look at, the tag...

  • Fun Tapestry Ideas

    Tapestries are large fabric decorative items, usually hung on a large section of wall with special tapestry rods, or framed. Tapestries traditionally...

  • Sun Java Struts Tutorial

    Sun's Java programming language is one of the most popular programming languages. It has a wide adoption for server-side development for web...

  • Development of a Struts Portlet

    The Struts framework is an open source platform for designing Web applications using the model-view-controller (MVC) model. Struts Portlet, on the other...

  • Struts 1.2 9 Tutorial

    Struts is the actual framework for developing web applications with the Java programming language. Struts is a layer on top of basic...

  • What Is Struts Plugin?

    Struts plugins are JAR files that contain classes and configurations that extend the functionality of the Struts framework. Struts plugins are installed...

  • Types of Action Classes in Struts

    Types of Action Classes in Struts. Web applications are different from simple websites and have different requirements, such as the ability to...

  • A Quick Tutorial on Struts

    Struts is a Web application framework that is written in the Java programming language. It is intended to facilitate the rapid development...

Related Ads

Featured