loading table of contents...

Content Application Developer Manual / Version 2310

Table Of Contents View Repository

The CAE uses a concept called ViewRepository to organize its views. A ViewRepository can be understood as a store that contains JSP or FreeMarker templates for beans of certain types.

Template Views

The default implementation ResourceViewRepository looks up templates for a given type at a location <package>/<class>.<fileextension> below a configured base location such as /WEB-INF/templates. For instance, a JSP template for a bean of type is looked up at a location /WEB-INF/templates/ A template for the same bean but with a specific view name asTeaser is looked up at location /WEB-INF/templates/



Note that the type's package name isn't mapped to a template location containing nested directories (like com/company/) but to a single directory (like

The file extension must match a supported view engine, that is, .jsp for a JSP template or .ftl for a FreeMarker template.

Programmed Views

Besides templates, a resource view repository might also contain so called "programmed views". These are view instances implemented in Java rather than in a template language. To write a programmed view, implement ServletView or TextView. If a programmed view is added to the predefined Map "programmedViews", it will be used for rendering.

For example, this is a simplified version of a programmed view implementation that renders com.coremedia.xml.Markup as plain text:

 * Programmed view that renders a given Markup as plain text
public class PlainView implements TextView {

  public void render(Object bean, String view, Writer writer, HttpServletRequest request, HttpServletResponse response) {

    Markup markup = (Markup) bean;
    // create serializer instance for scripts
    PlainTextSerializer handler = new PlainTextSerializer(writer);

    // transform and flush markup

This is how a programmed view is added to view repositories with a customizer:

<!-- programmed view to render plain markup -->
<bean id="plainView" class=""/>

<!-- add programmed views to predefined map "programmedViews" -->
<customize:append id="customProgrammedViews" bean="programmedViews">
    <entry key="com.coremedia.xml.Markup#plain" value-ref="plainView"/>

Search Results

Table Of Contents

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.