• Dependency lookup:
    • If resource of the application spending time to search and get dependent values from other resources of application  then it is called dependency lookup
    • Example :
      • If the student get his dependent value material from instruction by asking for it then is called dependency lookup
      • The way servlet / ejb component gets jdbc data source object form registry through jndi lookup operation is called dependency lookup
    • In dependency lookup resource perform “pull” operation on other resource or on underlying s/w to get the dependent values
    • Disadvantage: resource has to spend time to search and get dependent values
    • Advantage: resource can get only required dependent values

Note: in struts application form bean class is mediator for actionservlet to send multiple values of form pages to actionservlet class in the form of single object

  • Dependency injection:
    • if underlying s/w (or) framework server (or) special resource of application assign dependent values to resource, the moment resource is ready then it is called dependency injection or inversion of controller (IOC)
    • Example :
      • The way student gets his course material the moment to register for course is called dependency injection
      • If jdbc data source object is assigned to servlet object by servlet container the moment servlet object is created is called dependency injection
    •  In dependency injection underlying s/w or container/ framework server or special resource perform “push” operation on the resource of application to assign dependent values the moment resource is ready
    • Advantage: resource need not spend time to get dependent value and it can use dependent value at the moment resource is ready
    • Disadvantage: both necessary and unnecessary values will be injected
    • In struts the way action servlet dynamically assign form data to form bean class properties
    • By creating /locating formbean class object is called dependency injection or ioc

Note: the servlet container of web server / application server where struts application is deployed wills created actionservlet class object. This actionservlet create object for form bean and action class of struts application. The common thing the struts application contain is move architecture mvc design pattern