In my work, I have the client submitting some information via web browser. The struts-config.xml tells where to send that information. The data goes to the actionform, and then used by the action class. After hte actionclass is finished it forwards to a jsp page.
How does that fit into the diagram above? Can someone clarify what the diagram is showing in terms of how it fits into what I am doing? Maybe that image isn't a good example, but it is similar to a lot of other diagrams on the internet.
The controller servlet is the controller, as its name implies. ActionForms are one way to get information to the view--it's sort of a bridge (or was originally intended to be) between the model and the view.
So, by what you are saying, When sending something to the action class, say data in a form. The steps would be like this (in terms of the diagram)
A. Client will point to the controller
B. Controller would point to action form
C. Actionform would point to action class
D. Action class would point to JSP?
E. JSP would point to client
I thought the controller would be the struts-config file, when the action class uses something like forward.findmapping("PageX"), it will check the struts config file for the forward mapping, and forward to the relevant page.
It is supposed to illustrate when a client does something like submit a form. The action class uses that information and forwards the user to another page, or updates the current JSP. I'm sure there is a hell of a lot more going on under the belt than that, but at it's most basic, is that image accurate?
All of the Struts classes that have the term "Action" in front of them are part of the Controller. The Struts Controller is not implemented by a single class. It is implemented by a set of classes. At runtime, the Controller objects are all working together, e.g. ActionForm, ActionConfig, Action, ActionForward, ActionMapping, ActionServlet, etc.
Some of these Controller objects are part of the Struts code base. Some of the Controller objects are derived from data specified in the struts-config.xml files. And, finally, some of the Controller objects are written by application developers. This is how application developers build upon the framework to create their specific applications.
When the application is deployed, it reads the config file and creates the corresponding Controller objects in the JRE. Once this happens, the config file is never read again until the application is shut-down and restarted.
The ActionForm classes are written by the application developer and are for capturing HTML form data from the View and moving it into the Controller. Contrary to common misunderstandings, the ActionForm is not a Model object and should never touch Model code. Controller code extracts data from ActionForm, populates a Model data object and passes this to Model code.
So, the ActionForm is not the Controller, it is a small part of the Controller.
The application developer extends the Struts framework by writting custom ActionForm and Action classes. The application developer connects his custom classes with the core Struts code by creating the configuration XML file.