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去實現。