6

Please tell me what is the difference between ServletActionContext and ServletContext? ServletContext is shared among all the servlets and actions, while ServletActionContext is specific to an action or is that also shared among all the actions?

Roman C
  • 49,761
  • 33
  • 66
  • 176
user1147070
  • 491
  • 7
  • 21
  • `ServletActionContext` is not part of standard JSP/Servlet specs , it is provided by Struts, it provides a way to access to web objects like servlet parameters, request attributes and things like the HTTP session. – AllTooSir Jul 27 '13 at 09:04
  • thanks for the reply. But I want to know whether ServletActionContext is shared by all the actions or specific to an action – user1147070 Jul 27 '13 at 09:07

2 Answers2

2

These are different things. ServletContext is a servlet related, ActionContext is Struts 2 action related, ServletActionContext extends ActionContext but in major it's an utility class.

If you want to know what is the actioncontext.

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • Thanks. I have another doubt, Is ServletActionCotext shared by all actions or is that specific to one action? – user1147070 Jul 27 '13 at 12:05
  • @user1147070 I don't understand your question, `ActionContext` is created per action, and it's threadlocal, means not accessible by other actions/threads. – Roman C Jul 27 '13 at 12:16
0

ServletConfig Object:

  • It is ONE per our Servlet class object
  • Servlet container creates this either during server startup or during the deployment of web app based on Servlet configuration done in web-xml file
  • It is the object of servlet container supplied java class that impleents java.servlet.ServletCongfig(I).