Struts1.1实现的主要组成 主要包括:Action,ActionForm,ActionMapping,ActionForward,开发当中最主要写的是Action,ActionForm根据需要可以写或不写。下面我就一一具体介绍。 Action An Action is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to PRocess this request. 上面是Struts开发小组对Action的描述,说Action实际上Request和Business Logic中间的适配器.通俗的说就是从表单中取到数据并穿给商业逻辑操作进行一系列的操作,然后返回相应的操作信息。
ActionForm An ActionForm is a JavaBean optionally associated with one or more ActionMappings. SUCh a bean will have had its properties initialized from the corresponding request parameters before the corresonding action's execute() method is called. ActionForm实际上就是把从Request取到的数据封装并进行校验,然后把合法的数据给Action进行处理。实际上ActionForm除了进行数据校验之外另外更重要的是在表单回写的时候作用很大。反而在1.1以后数据校验的大部分工作在validation.xml去实现。