Bento framework is MVC (Model-View-Controller) framework for Servlet programming. It works like this:
| 1: | A single controller Servlet picks up the XML for input validation and checks if all the request parameters are valid or not. |
| 2: | If any of the request parameters are invalid, the controller Servlet generates the response from the XML that is selected in the previous step. |
| 3: | If all the request parameters are valid, the single controller Servlet picks up the model for the request path, and forward the request to the model. The model should be implemented as ServletWorker interface. |
| 4: | The model is responsible for working on the request parameters. It may save some of the request parameters into the SQL table, or select the records from the SQL table based on the request parameters. Or, it may send the e-mail. |
| 5: | Based on the result of the previous step, the model sends back a set of Strings to the controller Servlet. At this time, the model also indicates which template XML should be used for generating the response. |
| 6: | The controller Servlet inserts a set of Strings into the template XML and generates the response. |
You may wonder where are the view? The view are:
The controller Servlet calls the methods of ViewGenerator, and this API generates the response from the specified XML. Please click the link below and look into the source code example of the controller Servlet
| [ Source code example ... ] |
You may again wonder how the XML is selected? In the configuration XML of ViewGenerator, a set of paths to the XML is defined for each request path. Please click the link below and look into the example XML:
| [ Example XML for ViewGenerator ... ] |
Based on the configuration XML like this, ViewGenerator will pick up the corresponding XML for the request path, and this is why the source code of the controller Servlet can be relatively simple.
As the glue between MVC (Model-View-Controller), Bento framework uses RequestParser. This API is also used to save/retrieve HTTP request parameters into/from SQL table by RequestStore.
Copyright © 1997-2008 OOP-Research CorporationTM, All Rights Reserved.