Pages

Wednesday, 11 September 2013

Aware Interfaces of struts 2



In struts2 we don’t have any http specific objects by default just like in servlets.  If at all we want any http related objects in our Action class then we need to implement our Action class from Aware Interfaces provided by struts framework.
We can say hear frame work using one form of dependancy injection of type interface for injecting required objects into an Action class of struts2.
Struts 2 provided total of 5 Aware Interfaces
  • ApplicationAware Interface
  • SessionAware Interface
  • ServletRequestAware Interface
  • ServletResponseAware Interface
  • ParameterAware Interface

Every Aware interface provides a setter method, so we must override that setter method while implementing the particular Aware interface, at run time struts 2 controller will automatically calls that setter method and injects the required object into that Action class


No comments:

Post a Comment