Simple answers:
- Because that's how Struts 1 works.
- Because you have to map requests to actions somehow.
Longer answers:
1. In S1 everything depends on subclassing framework classes.(See notes) The base Action
class really only provides a small portion of framework functionality (messaging and resources, primarily), along with a small collection of other non-POJO framework classes, notably ActionForm
.
In Struts (and in lots of older software) programs were written to implementations, not interfaces. Action
is a class, not an interface. Most of the S1 framework's implementation references Action
, meaning that in order to fulfill framework method signatures and return values, you must subclass Action
.
2. One goal of MVC is to route requests to appropriate handlers. In S1 this is handled by the ActionServlet
. It looks at the request and, based on the Struts configuration, determines which action will handle the request. It acts (more or less) as the controller.
For further study: A significant portion of functionality, and a main point of extension, lies further beneath the surface, in the RequestProcessor
class. Note that instantiating actions to handle requests requires an Action
to be returned. This means that requests must be handled by an Action
, although any Action
subclass may be used, e.g., your own actions, a framework action like DispatchAction
or ForwardAction
, etc.
I would add that your questions can be answered by reading the wealth of information available about Struts 1 on its site and on the internet. Since the source is available it's also important to check and verify assumptions against it. I might recommend looking at Struts 1.2 source instead of 1.3 since there's a small layer of functionality added that clouds the basics.
All this said, unless you have a very compelling reason to do so, studying Struts 1 is a waste of time. It's been EOL'd, hasn't been recommended for new projects for years, is written in a pretty old style, etc. Modern Java web frameworks are much, much easier to work with. Struts 1 was written a Pretty Long Time Ago, before inheritance had fallen out of favor, before annotations existed, before marker interfaces were used all over the place, etc.