Posts

Quick Refresh : Struts2 : Flow, ActionMapper, ConfigurationManager, ActionContext, ActionInvocation, ValueStack

Image
Struts2  Struts 2 Flow: The flow of the struts 2 application, is combined with many components such as Controller, ActionProxy, ActionMapper, Configuration Manager, ActionInvocation, Interceptor, Action, Result, etc. A user sends a request for the action Container maps the request in the web.xml file and gets the class name of the controller. Container invokes the controller (StrutsPrepareAndExecuteFilter or FilterDispatcher). Since struts2.1, it is StrutsPrepareAndExecuteFilter. Before 2.1 it was FilterDispatcher. Controller gets the information for the action from the ActionMapper. means FilterDispatcher in turn uses the ActionMapper to determine weather to invoke an Action or not. If the action is required to be invoked, the FilterDispatcher delegates the control to the ActionProxy. Controller invokes the ActionProxy ActionProxy gets the information of action and interceptor stack from the configuration manager which gets the information from the struts.xml file. Th...

Quick Refresh : Spring : AOP, JDBC Template, Exception Handling

Aspect oriented programming (AOP):  Aspect-oriented programming, or AOP, is a programming technique that allows programmers to modularize crosscutting concerns, or behavior that cuts across the typical divisions of responsibility, such as logging and transaction management. The core construct of AOP is the aspect, which encapsulates behaviors affecting multiple classes into reusable modules. There are various common good examples of aspects like logging, auditing, declarative transactions, security, caching, etc.  Aspect:  An aspect is the cross-cutting functionality that you are implementing. It is the aspect of your application you are modularizing. An example of an aspect is logging. Logging is something that is required throughout an application. However, because applications tend to be broken down into layers based on functionality, reusing a logging module through inheritance does not make sense. However, you can create a logging aspect and apply it thr...

Quick Refresh : Spring : BeanFactory, ApplicationContext, Bean Lifecycle, Dependency Injection, Bean Scope, Inner Bean, depends-on, lazy-init, Autowiring

Benefits of Using the Spring Framework:    Spring enables developers to develop enterprise-class applications using POJOs. The benefit of using only POJOs is that you do not need an EJB container product such as an application server but you have the option of using only a robust servlet container such as Tomcat or some commercial product. Spring is organized in a modular fashion. Even though the number of packages and classes are substantial, you have to worry only about the ones you need and ignore the rest. Spring does not reinvent the wheel, instead it truly makes use of some of the existing technologies like several ORM frameworks, logging frameworks, JEE, Quartz and JDK timers, and other view technologies. Testing an application written with Spring is simple because environment-dependent code is moved into this framework. Furthermore, by using JavaBeanstyle POJOs, it becomes easier to use dependency injection for injecting test data. Spring's web framework is a...