What is the difference between ServletContext and ServletActionContext
Asked Answered
T

2

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?

Taal answered 27/7, 2013 at 9:2 Comment(2)
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.Bouldon
thanks for the reply. But I want to know whether ServletActionContext is shared by all the actions or specific to an actionTaal
M
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.

Muenster answered 27/7, 2013 at 11:52 Comment(2)
Thanks. I have another doubt, Is ServletActionCotext shared by all actions or is that specific to one action?Taal
@Taal I don't understand your question, ActionContext is created per action, and it's threadlocal, means not accessible by other actions/threads.Muenster
M
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).
Magnificent answered 25/6, 2017 at 17:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.