-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Learning Alfresco Web Scripts
By :

Web scripts in Alfresco mostly use the model-view-controller pattern. However, it isn't mandatory to follow this pattern all the time. The way MVC pattern works in web scripts is as follows:
The model-view-controller pattern in web scripts is explained as follows:
The mapping of the web script URI to the controller is done through a descriptor file. It is mainly an XML file that will have the required details for a web script such as URL, description, arguments, transaction, authentication, and response formats.
Response formats are mapped to FreeMarker templates through naming conventions. For example, a FreeMarker template that returns an HTML response will have the extension html.ftl
.
Web scripts are registered and executed by the web script engine in Alfresco.
A descriptor, optional controller, and one or more FreeMarker response templates collectively make a web script in general scenarios.
All these components are tied together through a specific document naming convention.
To make web scripts work, it is important to deploy the web script files at an appropriate location.
The descriptor file and the FreeMarker template as per the response format for a web script can be either placed on a filesystem or put into the Alfresco repository.
If a JavaScript-based controller is used for a web script, then it could be placed along with the descriptor and FreeMarker template on a filesystem or in the Alfresco repository.
If a Java-based controller is used for a web script, then the class file for the controller must be available on the class path.
There are two types of controllers available for web scripts: JavaScript-based controllers and Java-based controllers. It is possible to have none of them, either of them, or even both of them for a web script.
Change the font size
Change margin width
Change background colour