Creating and Building ActionForms
暂无分享,去创建一个
This chapter walks through the creation of Struts ActionForms and Dynamic Action-Forms, also known as DynaAetionForms. The ActionForm Bean is considered part of the View in the MVC model. While it's frequently found that some of the properties in an Action-Form correspond to properties in the model, the ActionForm is used by the JSP to transfer the state between the View and the Model components. ActionForm Bean class can be used by extending org.apache, struts.action.ActionForm. There is typically an ActionForm Bean defined for each of the input forms in individual application; however, the implementation is flexible to specific application needs. ActionForms are serializable. In Struts 1.0.2, this was not the case. There were two nonserializable instance variables (servlet and multipartRequestHandler) that were made transient to enable serialization. The ActionForm validate() method is used by the ActionForm to perform any required validation on input fields that have been submitted. Whether or not the validate() method is called is determined by what is specified in the ActionMapping definition. The next method is ActionForm reset() method. Following these methods, there are several forms in the application. The chapter demonstrates what ActionForms and DynaActionForms are and how to use them. It looks at some basic design strategies, and it takes on a walkthrough of how to build wizard functionality forms. It is obvious that there is a close tie between ActionForms and the way the custom tags work in conjunction with the forms.