Struts ideas:
1. actionform, dispatchaction, and actionmapping used by struts
2. Main concerns: form, action, and forward
3. how to send request parameters and intercept parameters in the background. do request, how to assemble parameters into form, how to operate form in action, how to find the target page, how to return form to the page, how to read form attributes through tags on the page
Framework main process:
All struts requests must follow the public actionforward execute (actionmapping mapping, actionform form, httpservletrequest request, httpservletresponse res) method of the dispatchaction class.
You can reload the execute method (to complete user verification and database connection initialization), and switch the operation to the processing method based on the method parameter.
framework details:
1. receive. do request
2. convert the parameter to actionform
3. find the corresponding dispatchaction and pass the actionform to the corresponding method of the dispatchaction
4. locate the target page from mapping, serialize the actionform, and send it to the page
5. the page parses the form using tags.
framework code details (processing HTTP requests and returning them):
1. actionmapping mapping = processmapping (request, response, PATH);
2. actionform form = processactionform (request, response, Mapping);
3. processpopulate (request, response, form, Mapping);
4. actionforward forward = processactionperform (request, response, action, form, Mapping);
5. processforwardconfig (request, response, forward);
6. response. sendredirect (response. encoderedirecturl (URI);
7. requestdispatcher RD = getservletcontext (). getrequestdispatcher (URI); Rd. forward (request, response);
Start with the configuration file and resolution configuration file
1. Structure of struts-config.xml
A. Main elements: Data-sources, form-beans, action-mappings, global-forwards, global-exceptions, message-resources, and plug-in
B. Use the common-digester toolkit and DTD for automatic XML parsing and Loading
2. parsing the process of struts-config.xml
A. moduleconfig is a Java object paired with the struts-config.xml
B. After the xml configuration information is loaded into the memory, the resource is allocated to each required module and initialized.