• In a single struts app we can have multiple form pages, multiple form beans class, multiple ActionClasses and multiple result pages.
    • For example:
      • Register. jsp--- form page name
      • Registerform--- form beans class name
      • Registeraction --- action class name
  • If resource names of struts app are designs based on naming convention then the resource name will become self descriptive
  • Struts s/w is created based on java, servlet, jsp and other java technologies.
  • To use this technologies effectively  the resource s/w  creator have used set of design pattern
  • These are called implicit or built in design pattern of struts s/w
  • Some important design pattern are
    • Mvc- whole framework s/w
    • Singleton java class- ActionServlet
    • Formbean-value object/data transfer object
    • Front controller- ActionServlet
    • Dependency injection or inversion of control- whole framework s/w
  • All these design pattern implementation related understanding helps the programmers to understand struts architecture more thoroughly
  • Singleton java class:
    • The .java class that allows to create only one object per jvm is called singleton java class
    • Instead of creating multiple objects of java class having same data it is recommended to create only one object for the class and use that object for multiple number of times
    • Most of the jdbc driver classes are designed as singleton java classes. So that when multiple app of a project use some jdbc driver class the driver class object will be created only once and it will be utilized for multiple time . so by this we can minimize memory wastage
    • In struts app ActionServlet is singleton java class
    • By default every normal servlet is single instance and multiple threads component and we need to make normal servlet as singleton java class
    • When multiple requests are given to a normal servlet then server creates only one object of the class and starts multiple threads on it representing multiple requests. This is called single instance multiple thread behaviors
FAQ
Action servlet is also a servlet and every servlet is single instance multiple threads components than why struts s/w creator have made action servlet as singleton java class
-some server like web logic, are creating multiple objects for our servlet class when huge amount of request are given to servlet simultaneously or parallel creating multiple object of our servlet class is against to our servlet api specification
-In order to see only one object of action servlet in all the servers irrespective of number of request that are coming to ActionServlet (for more request /less request ) the designer of thread s/w had explicitly made action servlet as singleton java class