What is struts 2.0




















Data Science. Angular 7. Machine Learning. Data Structures. Operating System. Computer Network. Compiler Design. Computer Organization. Discrete Mathematics. Ethical Hacking. Computer Graphics. Software Engineering. Web Technology. Cyber Security. C Programming. Control System. Data Mining. Data Warehouse. It's also important to go through the major differences between Struts 1.

Table of content:. Today's world is 'online world' where people are highly dependent on the internet and web applications. Millions of web applications and thousands of technologies are available in the market for enterprise application development.

Struts is MVC Model2 architecture based framework. MVC means Model-View-Controller where model is responsible for business logic, view handles the user interaction with application and controller decides the flow of application.

Figure 1. Main advantage of this architecture is the separation of data layer, presentation layer and pure business logic. The framework also provides ready to use validation framework. Struts is an open source framework developed by Apache Software foundation.

It can be downloaded as a free source from apache website. Struts can be broadly classified as Struts 1. X and Struts 2. Though Struts 2. X is successor of Struts 1. X, there is a vast difference between them.

Struts 2. ActionServlet is the name of a class that plays role of controller in Struts. Whenever the user sends a request to server it passes via ActionServlet which then decides the necessary model and sends this request to the respective model.

Two more files support the flow of application: web. It mainly concentrates on the business logic and semantics of the application. View is responsible for getting the input from the user and rendering the result of that input sent back to user. Let's discuss Struts 2 architecture diagram. Struts 2 architecture is divided in 4 major categories. Figure 2. When a user sends a request from browser to web server, the request reaches to ServletContainer. The request passes through the sequence of filters and cleanup classes.

ActionContextCleanup is used when we integrate Struts with other Java technologies but it is an optional filter.

It is also an optional filter. The next is FilterDispatcher. After the Action fires, a Result selects a resource to render the response. The resource is generally a server page, but it can also be a PDF file, an Excel spreadsheet, or a Java applet window. By creating these components, we are separating the work flow into three well-known concerns: the View, the Model, and the Controller.

Separating concerns makes it easier to manage applications as they become more complex. If you like, fire up your Java IDE, and enter the code as we go. The example code for this tutorial, helloworld, is available for checkout from the Struts 2 GitHub repository at struts-examples.

The example projects use Maven to manage the artifact dependencies and to build the. The Struts 2 user mailing list is an excellent place to get help. If you are having a problem getting this application to work search the Struts 2 mailing list. Be sure to note the package statement below. Note that in the code shown below the JavaDoc comments are omitted.

In the download example, JavaDoc comments are included.



0コメント

  • 1000 / 1000