You are here

Developing a Hello World web script

Building a Hello World web script is the best way to gain an understanding of the Web Script Framework. This example is simple enough to build and execute within a few minutes.
The Hello World web script consists of one web script description document and one FreeMarker response template, both created by using Alfresco Share.
  1. Log in to Alfresco Share.
    1. Type http://localhost:8080/share in the web browser.
    2. If prompted, log in with the user name admin and password admin.
    3. Click the Repository link on the Share header.
    4. Navigate to Data Dictionary > Web Scripts Extensions.
  2. Create a web script description document for the Hello World example.
    1. Click the Create menu item, and select XML to create a new XML file.
    2. Enter hello.get.desc.xml as the web script name in the Name field.
    3. Enter the following in the content box:

      
      <webscript>
        <shortname>Hello</shortname>
        <description>Polite greeting</description>
        <url>/hello</url>
      </webscript>
      
      
    4. Click Create.
    5. Click Web Scripts Extensions folder again.
  3. Create a web script response template to render the Hello World greeting.
    1. In the Create menu, create a Plain Text file.
    2. Enter hello.get.html.ftl as the template name in the Name field.
    3. Type Hello World in the Enter Content box.
    4. Click Create.
  4. Register the Hello World web script with Alfresco.
    1. Open a new browser tab.
    2. In the new tab, type http://localhost:8080/alfresco/service/index.
    3. If prompted, log in with the user name admin and password admin.
    4. Click Refresh Web Scripts.

    A message indicates there is one additional web script.

  5. Type http://localhost:8080/alfresco/service/hello in the web browser to test the new web script.

    A Hello World message is displayed, indicating your web script is working.