A cartridge is a functional component that a content administrator can choose to display on a page.
The basic aspects of a cartridge are the following:
The cartridge instance configuration, which consists of a content item created by a business user in Experience Manager
The cartridge handler, which is the Assembler component that contains the processing logic for the associated feature
The response model, which is the content item returned from the Assembler to the application for rendering
The configuration model for a cartridge is defined by a cartridge template, which describes the properties that can be configured as well as the interface through which the content administrator can specify their values in Experience Manager. Cartridges typically have configuration options specific to the cartridge's function, such as the number of refinements to display (and the order in which to display them) for a Dimension Navigation cartridge; the records to promote for a Spotlight cartridge; or the sort options and records per page for a Results List cartridge.
At query time, the configured values of the cartridge properties become an input to the Assembler.
The Discover Electronics reference application contains several sample templates or cartridges that demonstrate core functionality. You can customize them for your own application or write your own templates in order to add or remove configuration options or to pass additional information to the Assembler or the front-end application.
At query time, the Assembler invokes the appropriate cartridge handler to process the cartridge configuration.
The core cartridge handlers also have access to information about the initial request context that triggered the cartridge. The cartridge handler is responsible for generating a response model based on this configuration. In most cases this involves fetching content from an ext ernal resource.
In the case where the configuration model is the same as the response model, no cartridge handler is needed; the default behavior of the Assembler is to pass the configuration properties through to the response model.
The Assembler passes the response model to the corresponding renderer in the application.
As a best practice, the application should contain several modular renderers, each intended to handle the output model for a particular cartridge or cartridge type. The Discover Electronics application includes reference JSP pages to render each cartridge. These renderers are intended to be updated for styling or otherwise customized for your application.