Newsletter |
Aware Interfaces of struts 2
Struts » on Oct 23, 2011 { 3 Comments } By Sivateja
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 here 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
You Might Also Like
::. About the Author .:: | ||
Comments
3 Responses to “Aware Interfaces of struts 2”
ServletContextAware is not the part of Struts 2 Aware Interfaces?
@Abhishek Aggarwal
In fact we can get ServletContext object with ServletContextAware interface, in this case we have to call setServletContext() method.
But sometimes ServletContextAware interface is not working properly,
ServletContextAware is not the part of Struts 2 Aware Interfaces?