1. Struts' advantage is mainly reflected in two aspects: taglib and page navigation. Taglib is a Struts tag library, flexible, and is currently in China, in addition to using JSP's own common tags, rarely develop their own tags, maybe Struts is a good starting point. About page navigation, I think that will be a development direction in the future, in fact, doing so, make the system's context more clear. With a configuration file, you can grasp the contact between the entire system, which has a great advantage for later maintenance. 2. A simple example, such as a shopping cart program, to implement such a function of adding a commodity in the shopping cart, you can write a shopping cart operation JavaBean, build a public additem member method, direct access JSP file directly Call this method to implement. If you need to judge whether there is goods after adding items, no goods can be purchased, at this time we can directly modify the JavaBean AddItem method, join the processing statement to implement, so you don't have to modify the front desk JSP program. 3. Be wary of "premature optimization". First let it run, then consider getting faster 4. The Struts tag library used by JSP window components consists of four types of tags: Bean tag: Manage Bean logical tags in JSP page: Used in JSP Page Middle Control Process? HTML Tag: Used to generate an HTML tag, display data in the form, program the URL using the session ID? Template mark: Use a dynamic template to construct a normal format page 5. The controller calls the specific action Execute method, The ActionForm object will use the parameters in the HTTP request to populate yourself, and you can call the validate method in the ActionForm class to check the legality of the request parameter, and you can return an ActionerRors object containing all error messages.
Action is simple, usually only one Execute method, which is responsible for performing the corresponding business logic, if necessary, it also performs a corresponding data check. After the execution is complete, return an ActionForward object, and the controller is forwarded by the ActionForward object.
To start the automatic verification, you also need to set the validate property of the Action configuration to true.