Page 3 of 4
- What is the difference between RequestAware and ServletRequestAware interface ?
RequestAware and ServletRequestAware both makes your action to deals with the servlet request, but in a difffrent ways,RequestAware gives you the attributes in the servlet request as a map( key as attribute name and value is the object added),But ServletRequestAware gives you the HttpServletRequest object itslef giving you more flexibility, with a price that ServletRequestAware makes your Action class too much tied to the Servlet environment making it dificult to unit test. So whenever a need to access only the attributes use the RequestAware interface.
- What is the difference between EL and OGNL ?
OGNL is much like EL in JSPs,a language to traverse or manupulate objects like request , session or application in web context.OGNL stands for Object graph navigation language,which is used internally by Struts2, however we are not bound to use OGNL in our JSPs, we can use EL.But OGNL provides much more facilities than plain EL.For example while El interacts with the objects by means of getters/setters, OGNL supports whatever EL does along with lambda experssion, helps create functions on fly. OGNL has more flexible ways to deal with collection of objects.
- What are the difference between ActionContext and ServletActionContext ?
ActionContext represents the context in which Action is executed, which itself doesn't hold any web parameters like session, request etc. ServletActionContext, extends the ActionContext and provides the web parameters to the Action.
- What is the life cycle of Interceptor ?
- Who executes/Which class in Struts2 executes the interceptors ?
- In what order the interceptors execute in an interceptor stack ?
- What is action scope and how is it different from request scope ?
- What happens if you don't call the invoke() method in any interceptors' intercept() method ?
- How can two interceptors in a stack communicate or If you were to pass some value from one interceptor to another, by using this value the next interceptor executes some specific statements, how would you do it ?
- What is dynamic method invocation ?