Web Editor

Showing results for 
Search instead for 
Did you mean: 

Web Editor

0 0 4,497

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



The Alfresco Web Editor (AWE) is a Spring Surf based web application that utilises the Forms Service to provide in-context editing capabilities to Alfresco repository content (non AVM).

This page provides details on deploying and configuring AWE using the distributed artifacts, alternatively, to get up and running quickly using the latest code in HEAD you may prefer this Getting Started guide.

Documentation about the client side framework can be found at the Web_Editor_Framework page.


The distribution of AWE consists of a single zip file named alfresco-community-webeditor-<version>.zip (at the time of writing only available from the nightly build).

WAR File Deployment

The simplest and quickest way to deploy AWE is to use the pre-built WAR (awe.war) file and deploy it in the same application server instance of your web application.

Being a Spring Surf based application AWE does not have to be deployed in the same application server instance as the Alfresco repository, however, this section presumes that it is. The diagram below depicts this.


The 'Web Application' box represents your web application. The AWE tag library provides the ability to mark areas of the page as editable. The areas marked can represent any property or content from the Alfresco repository. The file named 'alfresco-webeditor-taglib-<version>.jar' needs to be copied to the WEB-INF/lib folder of your application. To include the tag library in your application simply add the following tag library declaration to your JSP page:

Once the tag library is declared the 'startTemplate', 'endTemplate' and 'markContent' tags can be used within your application. Full documentation on the tag libraries can be found below. An example application (customer.war) is also available demonstrating how to integrate and use the AWE tag library, full details of the customer sample can also be found below.

Marking content using the 'markContent' tag result in an edit icon appearing in your application, clicking this icon results in a form being displayed to allow the content and/or properties to be edited. It's highly unlikely that the default form configuration provided out of the box will be sufficient, a configuration file hook is therefore provided by the awe.war to allow custom form configuration to be provided. Presuming your Tomcat instance is set up to allow for shared classes a file named 'awe-config-custom.xml' can be placed in the shared/classes/alfresco/web-extension folder which can contain your custom form configuration.

This custom configuration file can also be used to tell the AWE where to find the repository. By default it will assume a location of http://localhost:8080/alfresco/s/. In order to change this default put the following in to the AWE config file with the appropriate values for 'MYSERVER' and 'MYPORT':

         <element-reader element-name='remote' class='org.springframework.extensions.config.RemoteConfigElementReader' />

   <config evaluator='string-compare' condition='Remote'>
            <name>Alfresco - user access</name>
            <description>Access to Alfresco Repository WebScripts that require user authentication</description>

Spring Surf Application Deployment

The AWE distribution also includes all the files required to provide the AWE functionality within an existing Spring Surf application, to do so copy the following files to your application's WEB-INF/lib folder:

  1. yui-2.7.0.jar
  2. spring-webeditor-1.0.0.CI-SNAPSHOT.jar
  3. alfresco-forms-client-3.3.jar
  4. alfresco-webeditor-plugin-3.3.jar

The YUI and spring-webeditor JAR files represent the Web Editor Framework (WEF) which AWE is built upon. Details of the WEF can be found here. The remaining 2 JAR files provide the AWE functionality. If you plan to use AWE within the app (as opposed to the application just being a host for the AWE services) you will also require the following 2 files to be copied into WEB-INF/lib:

  1. spring-webeditor-client-jsp-1.0.0.CI-SNAPSHOT.jar
  2. alfresco-webeditor-taglib-3.3.jar

If you do use these files a servlet filter has to be defined in your application's web.xml file. If the filter is not provided the tags will be ignored. The following filter configuration is required:

    <filter-name>Alfresco Web Editor Filter</filter-name>
    <description>Enables support for the Alfresco Web Editor</description>
   <filter-name>Alfresco Web Editor Filter</filter-name>

Please note that the 'contextPath' parameter has to be set accordingly, if this is not provided a default contextPath of '/awe' will be presumed.

No further configuration is required, all the necessary Spring context files and Alfresco configuration files are contained within the JAR files. However, this does mean there is no default hook point for custom form configuration but as you have control over the application any necessary configuration can be located anywhere you desire.

The 'customer' sample can still be used as an example, simply deploy the customer.war file and once exploded edit the web.xml to point the AWE servlet filter to your application.


There are 3 main areas of configuration: the tag library (mainly the 'markContent' tag used to define what is actually editable); the AWE servlet filter; and the form configuration. Each is described in the following sections.

Tag Library

The tag library is made up of 3 tags, 'startTemplate', 'markContent' and 'endTemplate'.


The startTemplate tag bootstrap's the WEF via a 'script' element that executes a webscript, this tag should therefore be placed in the 'head' section of your page.

The startTemplate tag has only one optional attribute.


The toolbarLocation attribute controls the initial location of the toolbar, valid values are 'top', 'left' and 'right', the default is 'top'.

An example use of the startTemplate tag is shown below.

<awe:startTemplate toolbarLocation='top' />

The startTemplate tag renders the following HTML (presuming the default contextPath is being used).

<script type='text/javascript' src='/awe/service/wef/bootstrap'></script>


The markContent tag indicates an editable area of the page. The tag renders an edit icon that when clicked displays a form for editing the corresponding Alfresco content and/or properties.

The markContent tag has two mandatory attributes and two optional attributes.


The mandatory id attribute specifies the NodeRef of the Alfresco node to be edited.


The mandatory title attribute defines a descriptive title for the editable area being marked. The title used will be used in the quick edit drop down menu of editable items, as the title of form edit popup/dialog and the 'alt' text and tooltip text of the edit icon.


The optional formId attribute specifies which form will be used when the marked area is edited. See the Form Configuration section below for more details.


The optional nestedMarker attribute defines whether the editable area is nested within another HTML tag that represents the content being edited. If set to 'true' the whole parent element is highlighted when the area is selected in the quick edit drop down menu. If set to 'false' only the edit icon is highlighted.

An example use of the markContent tag is shown below.

The markContent tag renders the following HTML for each bit of content marked on the page.

<a href='/awe/page/metadata?nodeRef=[nodeRef]&js=off&title=[title]&redirect=[redirect]'>[title]</a>

The [nodeRef] and [title] placeholders are replaced with the values from the tag's attributes. The [markerId] is an id generated to uniquely identify the span representing the marked content.


The endTemplate tag is responsible for initializing AWE with details of all the marked content areas on the page. It also renders a 'script' element that executes the WEF resources webscript which starts the process of downloading all the assets required to render and display the toolbar and all configured plugins, this tag should therefore be placed just before the closing body element.

The endTemplate tag does not have any attributes.

An example use of the endTemplate tag is shown below.

<awe:endTemplate />

The endTemplate tag renders the following HTML (presuming the default contextPath is being used).

<script type='text/javascript'>
   position: 'top'

   id: 'awe',
   name: 'awe',
   editables: [
      id: '[markerId]',
      nodeRef: '[nodeRef]',
      title: '[title]',
      nested: false,
      redirectUrl: window.location.href

<script type='text/javascript' src='/awe/service/wef/resources'></script>

The 'editables' property is an array of objects representing each piece of marked content on the page, only one is shown here for brevity.


The startTemplate, markContent and endTemplate tags will only render their output if they detect the presence of the AWE servlet filter. This means the tags can remain in the JSP page in production and have no effect (presuming the servlet filter configuration is removed from web.xml).

To enable the tags the following servlet filter configuration needs to be added to the web application's web.xml.

   <filter-name>Alfresco Web Editor Filter</filter-name>
   <description>Enables support for the Alfresco Web Editor</description>
   <filter-name>Alfresco Web Editor Filter</filter-name>

Two optional parameters are also available, they control the contextPath used when URLs to AWE are generated and the debug mode of AWE.




AWE uses a form to edit the node referenced by a 'markContent' tag, be default the form displayed will contain the 'cm:title', 'cm:description' and 'cm:content' fields. An alternative form can be used by providing the 'markContent' tag with a 'formId' attribute. Out of the box only two other forms are configured, a form with an id of 'title' and one with an id of 'description'. As the id's indicate the forms just display a single property, 'cm:title' and 'cm:description', respectively.

Furthermore, the node type is presumed to be 'cm:content'.

If you have custom types or wish to specify other properties the usual forms configuration techniques can be used. When starting up, the AWE looks for a configuration file on the classpath named 'alfresco/web-extension/awe-config-custom.xml'. Place any custom form definitions in this file.


An unsupported 'customer' WAR file is available in the AWE distribution, it shows how a customer may use AWE in a very simple JSP based web application.

A 'customer' tag library is provided, which includes two tags, 'content' and 'property', as their name suggest, they allow content and properties to be pulled from an Alfresco repository and output to a JSP page. These are included purely as a demonstration sample and should NEVER be used in a production environment.

The 'content' tag requires one mandatory attribute called 'nodeRef'. The 'property' tag requires two mandatory attributes, 'nodeRef' and 'property'. An example use of both tags is shown below.

The sample 'customer' application consists of several simple JSP pages that display the content and properties of two nodes from the repository, the /includes/noderefs.jsp page should be updated to provide the NodeRef's of two nodes in your repository.

By default the sample will pull content from the Alfresco repository located at 'http://localhost:8080/alfresco' using a username and password of 'admin/admin'. These values can be provided via 'context-param' values in web.xml. An example is shown below.