Book Image

Learning Alfresco Web Scripts

By : Ramesh Chauhan
Book Image

Learning Alfresco Web Scripts

By: Ramesh Chauhan

Overview of this book

Table of Contents (18 chapters)
Learning Alfresco Web Scripts
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Adding arguments to a web script


Let's say we want to modify our first web script to display the name too in the web script response, for example, Hello! Ramesh. It can be done in a simple way by passing the name as the URL argument of the web script and then using this argument to generate the response in the FreeMarker template. In order to do this, we will have to perform the following steps:

  1. Log in to Alfresco Share UI.

  2. Click on the Repository link from the top header.

  3. Edit the descriptor file helloworld.get.desc.xml at Data Dictionary | Web Scripts Extension location as follows:

    <webscript>
      <shortname>Hello World</shortname>
      <description>First webscript Hello world</description>
      <url>/helloworld?name={argumentName}</url>
    </webscript>
  4. Edit the FreeMarker template helloworld.get.html.ftl at Data Dictionary | Web Scripts Extension as follows:

    <html>
      <body>
        <p>Hello! ${args.name}.</p>
      </body>
    </html...