Struts2 learning

struts2 learning: web.xml configuration filter: <filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></ filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping> struts.xml configuration action: <struts><constant name ="struts.devmode" value="true"></constant> //Development mode, automatic configuration modification <package name="default" namespace="/" extends="struts-default"><action name="hello "><result> /hello.jsp </result></action></package></struts> struts2 operating mechanism: the client sends a request to the server, and the server determines the accessed application according to the url, and then looks under the application The configuration file web.xml, the filter configured in the configuration file will filter out all url addresses, and then hand it over to the StrutsPrepareAndExecuteFilter class for processing,This class will call the dofilter() method to call the corresponding namespace() and action from the struts2 configuration file, return the corresponding result, and finally feed the result back to the client.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326726928&siteId=291194637