In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to understand Struts framework, the content is concise and easy to understand, absolutely can make your eyes shine, through the detailed introduction of this article I hope you can gain something.
Because Struts framework is widely used in the world, many people learn it, but most people spend too much unnecessary time and energy in some less important places, resulting in high learning costs and poor results. I here according to the summary of years of training experience, carefully designed a set of learning Struts framework curve, let everyone learn Struts framework fast and accurate, save everyone valuable time, will certainly be of great help to you learners.
As you know, Struts is an open source project of Apache Foundation Jakarta Project Group, which adopts MVC design pattern and is a WEB presentation layer framework based on Sun J2EE platform. Here are a few concepts worth noting: Open Source, MVC, J2EE, Web Presentation Layer, Framework. Let me explain them one by one.
Open source: Needless to say, the source code allows you to analyze it line by line to gain insight into its internal implementation mechanisms.
MVC: It forcibly separates the input, processing, and output of an application. Applications that use MVC are divided into three core components: model, view, and controller. They each handle their own tasks.
J2EE: J2EE is a de facto industry standard for developing enterprise applications using Java technology. J2EE groups the different parts that make up a complete enterprise-class application into different containers, each containing several components (which need to be deployed in the corresponding container), and various components can use various J2EE services/APIs. One of the most commonly used containers is the WEB container (that is, we often say WEB server), the two most core components are JSP and SERVLET. Struts is based on these two technologies and relies on WEB containers.
WEB Presentation Layer: We often say J2EE four-tier architecture: WEB Presentation Layer, Business Logic Layer, Persistence Layer, Database Layer. This is a logical division. The Web presentation layer is characterized by relying on the Web server to deal directly with the client (usually the Web browser). Struts is in the WEB presentation layer, which mainly accepts and processes user requests and responds to the processing results to the user.
Framework: In layman's terms, a framework is a "half-finished product" that does something generic for you to configure and extend. The strength of a framework is not what it allows you to do, but what it does not allow you to do! It gives structure to chaos. Let's make an analogy. A frame is like a house with many beams. When you need to expand the house, such as adding new rooms, windows and hallways or adding a fireplace to the bedroom, you don't have much choice because of the beams. Fewer beams give you more options, but you probably don't feel safe living in a house with a roof like this when a typhoon or earthquake strikes. In short, framing is a precise balance between structure and creativity.
All right. It is assumed that you understand the above concepts and will use JSP/SERVLET to make some common WEB applications. Now let's see how to learn Struts Framework. Here I take Struts version 1.2 as an example. (Struts 2.0 implementation is quite different from previous versions, as I'll explain later.) Let's go!
First of all, you have to follow the book or online examples to run a simple Struts application, that is, in the client display a HELLOWORLD kind of, this is a sneak peek. Here you begin to get into touch with what you need to make a Struts application: Struts JAR packages, configuration of the core controller ActionServlet on web.xml, writing of actions for specific user request URLs, and Struts-config.xml, the core configuration file for Struts applications. Stop and think about it when you're done.
Then, you start running a slightly larger user login application, successfully jumping to our main page, failing to continue back to the login page. We introduce ActionForm components and operations on the background database. At this point MVC works. ActionServlet and Action written by myself act as front and back controller components respectively, DAO/DTO acts as model component, JSP acts as view component. Struts-config.xml also becomes full up, starting with more configuration datasets, form-beans,action-mappings. After finishing, go online to find some good reference materials or use your own classic Struts desk book (*** is illustrated), and start to seriously ponder the operation principle and execution process of Struts, especially to understand the role of ActionForm components and Struts-config.xml This core configuration file uses configuration everywhere. At this point, you should start to understand: our own Action and ActionForm classes must inherit the existing Action and ActionForm of the framework, and after writing, they must be configured into Struts-config.xml.
Now that you have a general understanding of the Struts framework, you may be interested in other Struts topics. OK, now expand your landing app. Add validation first, or your system will be vulnerable. Authentication is divided into client-side authentication and server-side authentication. Server-side validation can be done in the validate() method of ActionForm, in the execute() method of subsequent Action classes, or even using validation frameworks. Here, we should focus on the learning of the verification framework. After completion, together with resource internationalization I18N, different language versions of the page are provided for customers in different regions and languages. We started writing resource properties files, started configuring them in Struts-config.xml, started using Struts 'own tags, etc. There are many knowledge points involved in this, which requires everyone to study patiently and carefully. When you run this app, you will find all kinds of exceptions and problems. Don't be afraid, these mistakes are our good friends, we should record them all and eliminate them tenaciously. Remember: Try to avoid repeating mistakes and don't fall twice in the same place.
That's how Struts framework is understood. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserves, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.