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:
- Log in to Alfresco Share UI.
- Click on the Repository link from the top header.
- 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>
- Edit the FreeMarker template
helloworld.get.html.ftl
at Data Dictionary | Web Scripts Extension as follows:<html> <body> <p>Hello! ${args.name}.</p> </body> <...