You are here

Programming with Surf

Surf lets you build user interfaces for web applications using server-side scripts and templates without Java coding, recompilation, or server restarts. Surf follows a content-driven approach, where scripts and templates are simple files on disk so that you can make changes to a live site in a text editor.

Surf is a Spring framework extension for building new Spring framework applications or plugging into existing Spring web MVC (Model, View, Controller) applications. Spring Web MVC provides separation between the application Model, View, and Controller (known as MVC). You can use Surf with other popular Spring Web MVC technologies including Tiles, Grails, and Web Flow.

Surf’s object model lets you define pages, templates, components, and themes using XML. The Spring application picks up new files and processes them through scripts and templates to produce the view, and writes scripts using server-side JavaScript and Groovy. Templates are written using FreeMarker and PHP. You can build both page-centric and content-centric websites using Surf, and it provides out-of-the-box support for rendering content delivered through content delivery services, such as CMIS, Atom, and RSS.
Note: The Groovy invokedynamic indy library is included in Alfresco. Depending on the JVM version, you can target close to Java performance for dynamic Groovy with invokedynamic support activated. If you plan to use the invokedynamic support, make sure you either use 7u60 or JDK 8.


  • Scripts and templates: Everything in Surf consists of scripts, templates, or configuration. This means no server restarts or compilation.
  • Reusability: Surf’s presentation objects, templates, and scripts emphasize reusability. Scoped regions and component bindings allow you to describe presentation with less code.
  • Spring Web MVC: Surf plugs in as a view resolver for Spring Web MVC, enabling you to use Surf for all or part of a site’s view resolution. Surf renders views on top of annotated controllers and is plug-compatible with Spring Web Flow, Spring Security, Spring Roo, and Spring tag libraries.
  • RESTful scripts and templates: All page elements and remote interfaces are delivered through a RESTful API. The full feature set of web scripts is available to Surf applications. Write new remote interfaces or new portlets with a script, a template, and a configuration file.
  • Content management: A set of client libraries and out-of-the-box components streamline interoperability with CMIS content management systems, letting you easily access and present Enterprise content using Surf components and templates.
  • Two-tier mashup architecture: Surf works in a decoupled architecture where the presentation tier is separate from the content services tier. Surf provides credential management and mashup mechanics so the rendered page can surface content from multiple back-end data providers. These might be CMIS, Atom, SOAP, XML, or JSON feeds.
  • Production, development, and staging/preview: Configure Surf to work in a number of deployment scenarios including development, preview, or production environments.
  • Development tools: Tools that plug into the SpringSource suite of development tools include Eclipse add-ons for SpringSource Tool Suite, as well as Spring Roo plug-ins to enable scaffolding and script-driven site generation.