wood burning stoves 2.0*
The moose likes Servlets and the fly likes struts ActionServlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "struts ActionServlet" Watch "struts ActionServlet" New topic
Author

struts ActionServlet

Ian Yang
Ranch Hand

Joined: Nov 27, 2001
Posts: 44
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.
zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
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.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
otherwise,if you want to study the code,you can unzip the "struts.jar",and decompile the "ActionServlet.class"
Dave Van Even
Ranch Hand

Joined: Jul 19, 2001
Posts: 101
Originally posted by zb cong:
otherwise,if you want to study the code,you can unzip the "struts.jar",and decompile the "ActionServlet.class"

or download the source code
Dave
 
 
subject: struts ActionServlet