Let beginners understand Struts
Novice learning Struts can better understand the object-oriented development method, the three-layer structure, the model driver and other concepts. Struts is a nice Java framework, but it contains quite a lot, and there may be many things that don't understand for those who have first contact it, especially Java newbies. According to my own understanding and practice, I feel that Struts is quite easy to get started, and many examples can be found online. However, these examples are more shallow, and there is no application to actual projects, such as how to connect the database, how to implement applications. Simply put, to apply Struts, it is to establish a corresponding ActionForm, Action, JSP page, and configure web.xml, struts-config.xml. If you use JBuilder, you can easily establish and manage these files. Of course, you can have a full experience in your later experience. Configuring struts-config.xml is quite simple, remember to add the corresponding form-beans, action-mapings. And if not involving more advanced development, there is almost no need to reconfigure web.xml. Establishing ActionForm is also very simple, just set the required object attributes, get in. In the JSP page, some tags can be used to make your code to clear, or still use traditional JSP writing to slowly improve. The most critical is the Action's writing. If you understand the working principle of Action, it has a great help to further master Struts. Objects commonly used in Action include ActionForm, Request (httpservletRequest), which is commonly used from Request.getSession (). There are two ways to pass the parameters passed from the page. If it is form data, it is actionform.getxxxx (); and additional form data and URL parameters can be used with request.getParameter (Name); To page output information, if it is an actionform, it is an actionform.setXXX (); another method is request.settribute (name, arg); pass to the content, from the page Request.GetaTribute (Name) Read . Many times you have to use this way to pass object data to the page, you should understand and remember. Another error message (not the program is abnormal) is generally processed through the ActionerRRORS object, a little bit of trouble, and later.
Struts has some other features, such as formats, international language support, plug-in extensions, etc., can not be considered for beginners.