Is Action class is Servlet or Not ? if yes why ?

Questions by enjoy

Showing Answers 1 - 15 of 15 Answers


  • Apr 13th, 2007

Nope !!

  Was this answer useful?  Yes


  • Nov 27th, 2007

Judging by the rules of inheritence, i would say that Action class is a Servlet.

  Was this answer useful?  Yes


  • Jan 2nd, 2008

No!!! Action class is not a servlet. it may resemble like Servlet since it is using HttpServletRequest and HttpServletResponse but actually its a plain java class which is been called/Managed by a well defined framework called Struts.


  • Jan 9th, 2008

In Struts1, Action Servlet is a servelet (since it extends HTTPServle) but Action class extents org.apache.struts.action.Action which has nothing to do with Servlet.

In Struts2, Action class extends com.opensymphony.xwork2.ActionSupport which has nothing to do with Servlet.

So, to answer the question, Action class is not a Servlet by any logic.

No,Action class is not a Servlet. Servlet is a helper application of the web server to produce dynamic content to the client. And Action class is also made for the same.

  Was this answer useful?  Yes

Action class is not a Servlet .
Any Java object which extends the functionality of servlet interface or HttpServlet or GenericServlet or it is subclass can be called as a servlet but our action class does not extend any of these.
For clarification go to web.xml, there we have to define all the servlets. You will not find Action class bec it is not a servlet.

  Was this answer useful?  Yes


  • Jul 6th, 2010

Actually the confusion is between two classes Action and ActionServlet. Be clear that these two are different classes. ActionServlet is a servlet but Action is a normal java class.

  Was this answer useful?  Yes

No Action class is not a  servlet since it is not overriding init(),service,destory methods at the same time its super classes are also not implemented these three methods.One thing i want to say is any servlet in the world should implement Servlet interface either directly or indirectly .But action class is not implementing like that so it is not a servlet

  Was this answer useful?  Yes


  • Oct 7th, 2012

No. the Struts action class neither extend any class nor implement any interface.

More over it has defined one method getServlet() .. discribes which servlet it associated with it. This will be Action Servlet, unless your write ur own Action Servlet.

public class Action {

An instance of TokenProcessor to use for token
* functionality.

private static TokenProcessor token = TokenProcessor.getInstance();

// NOTE: We can make the tken variable protected and remove Actions
// token methods or leave it private and allow the token methods to
// delegate their calls.
// ----------------------------------------------------- Instance Variables


The servlet to which we are attached.

protected transient ActionServlet servlet = null;

// ------------------------------------------------------------- Properties


Return the servlet instance to which we are attached.

* @return The servlet instance to which we are attached.
public ActionServlet getServlet() {
return (this.servlet);

  Was this answer useful?  Yes


  • May 17th, 2013

No.. Action class is not a servlet. The only servlet class in plain struts framework (without spring etc.) is ActionServlet.

  Was this answer useful?  Yes

Action class is not a servlet but it is having the properties like a servlet. For example servlets have request and response objects similarly action classes is also having request and response objects. So we can say action classes are having the servlet behaviour but they are not servlets. Since servlets are having init, service and destroy methods are there but action classes are not having these ..

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions