Extending the first web script to use the controller
The web script framework in Alfresco makes it easy to have a clear separation of concerns by following a model-view-controller pattern in order to develop a web script. All the business logic resides in the controller and it is possible to have multiple views as required to return the response in different response formats supported by the web script framework in Alfresco. The model object is a data structure used to pass information from the controller to the view. The controller populates the model object with the required data and passes it to the view to generate the response.
In the first web script, we created a basic and simple web script, which just renders the output without interacting with the Alfresco repository. Ideally, any processing related to business logic such as querying the Alfresco repository, creation of content, updating content, deleting content from the repository, and executing actions should be done in a controller...