Struts

Building Model component in framework
adplus-dvertising
Previous Home Next

Since MVC architecture divide into three main part:- Model, View, and Controller. So all the three part briefly describe below-

Model Component :

In general, the Model components strongly focusing on the creation of JavaBeans classes that support all of the functional requirements of the project. Different type of Bean describe below

  1. Scope of Bean : Within a web application, JavaBeans can be stored in (and access from) a number of different collections of "attributes". Each collection has different rules for the lifetime of that collection, and the visibility of the beans stored there. Together, the rules defining lifetime and visibility are called the scope of those beans. JavaBean define four different Scope such as

    • page : Beans request that visible within a single page or servlet( in which Bean is create)
    • request : Bean request that visible within a single page as well as to any page or servlet that is included in this page, or forwarded to by this page.
    • Session : Bean request that visible into many pages or servlet until the particular user session not expire.
    • Application : Bean request visible within the web application.
  2. Business Logic Bean :This beans is design for provide the encapsulate, logic function in the application. Business logic beans should be designed and implemented so that they do not know they are being executed in a web application environment for maximum code reuse. Every logic bean extend javax.servlet.* package.
  3. DynaBean( Dynamic Bean) :DynaBeans are the extensibility and flexibility according to the incoming request, defining even the simplest JavaBean requires defining a new class and coding a field and two methods for each property. The property of DynaBean can be configured via an XML descriptor, its property can't called by a simple java method but work well with reflection and introspection component.
  4. ActionForm Beans :ActionForm beans almost similar to the JavaBeans( ModelBeans) but should be consider a Controller component. Because, that able to transfer data between the Model and View layers. In struts framework the ActionForm is generally define by the extending the org.apache.struts.action.ActionForm, sometime ActionBean also called "form beans". These may be finely-grained objects, so that there is one bean for each form, or coarsely-grained so that one bean serves several forms, or even an entire application.
Previous Home Next