Reputation: 180
Hi I have Question we can use both Action Context and Servlet Action Context to access the resources But why Struts2 people implemented two if they work same
Upvotes: 1
Views: 3145
Reputation: 133
As quoted in: Servlet Action Description
Servlet Action Context is a sub class of Action Context.
"ServletActionContext is Web-specific context information for actions".This class adds access to web objects like servlet parameters, request attributes and things like the HTTP session. In simple terms one can say Action Context is generic while the servlet action context is more specific in terms of its usage
For Example: GenericServlet and HttpServlet; GenericServlet is for servlets that might not use HTTP, like for instance FTP servlets etc. while HttpServlet is more specific.
Upvotes: 0
Reputation: 160191
They don't work the same; one has web-app-specific functionality.
XWork is not a web app framework--hence the ActionContext. WebWork/Struts 2 added web-specific functionality, hence ServletActionContext, which is a subclass of ActionContext, and adds web-related stuff.
Upvotes: 2