This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
struts framework usually uses a centrilized ActionServlet as a controller, it goes to different action class and forwards the results to different jsp pages. In Apache jarkata it briefly talks about it but has not too much good details/examples. Anybody has any examples URL ? Thanks.
some sample projects also have such servlet,such as petstore.........,you can download the petstore from sun's website,extract the source code. maybe the MainServlet(i can't remember the name for sure) in petstore is the centralized servlet.
Technically, you can have more than one ActionServlet, but that would be an unusual case. The standard Struts ActionServlet takes care of decoding incoming URLs, managing FormBeans and other generally useful tasks, after which it passes control to the Action class that it thinks should handle the functionality specific to the request. You can do quite a bit using just the basic ActionServlet. This is why you may not find all that many examples of "using it" -- you simply refer to it in your web.xml file as the target for "*.do" requests and the ActionServlet gets its app-specific functionality from struts-config.xml. For more ambitious projects you an also subclass ActionServlet - for example, if the standard ActionServlet's database pooling functions don't serve your needs, extend ActionServlet with methods that do.
An IDE is no substitute for an Intelligent Developer.
Joined: Jan 14, 2002
otherwise,if you want to study the code,you can unzip the "struts.jar",and decompile the "ActionServlet.class"