Chapter 3: Struts Configuration
Struts PrinciPle and Practice Struts can run in any web container supporting JSP1.2 and servlet2.3
Struts submits all the requests to the same center controller, org.apache.struts.Action.ActionServlet class
Web.xml configuration
A standard URL style using Struts is as follows:
Extended mapping: http://www.my_site_name.com/mycontext/Actionname.do
Path mapping: http://www.my_site_name.com/mycontext/do/action_name
Struts run
Struts first calls the ActionServlet's init () method when the Container is started. Initialize various configurations. These configurations are written in the struts-config.xml file.
A standard Struts-Config file contains the following structure:
XML Version = "1.0" Encoding = "UTF-8"?>
Struts consists of several parts described above. The most important one is Action and Form. The following is simply described below.
A request submits to the ActionServlet, ActionServlet looks for the corresponding Form and Action, first map the submitted request object to the Form. , Then pass the Form to the action for processing. Action gets FORM, the XML's mapping, request, and the execute () method then returns a Forward-URL (corresponding view) to the ActionServlet, eventually returned to the client. Let's take a simplest instance.
Chapter 4: EXAMPLE 1: Basic Framework
Struts PrinciPle and Practice Description: Example One is the simplest Struts program. It only uses 1 Form and 1 Action function to pass the value of the page input to the Action, and return the result after judgment. If it is freedom to return EMPTY code as follows:
INPUT.JSP: