- Learning Alfresco Web Scripts
- Ramesh Chauhan
- 265字
- 2021-08-05 17:28:04
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> </html>
- Register the web script by hitting
http://localhost:8080/alfresco/service/index
and click on the Refresh Web Scripts button. - Now, hit the URL
http://localhost:8080/alfresco/service/helloworld?name=Ramesh
in order to execute the web script. On execution, you should be able to see Hello! Ramesh. as the output.
Note
It is important to understand here that even if you had not provided name={argumentName}
in the third step and hit the URL to execute the web script, as mentioned in the sixth step, then you would also have got the same result. Specifying name={argumentName}
in the description document helps you know about the arguments used by web script. This way, by just looking at the description document, you will know about the arguments for web script. As a good practice, you should always add the arguments used by your web script in its description document.
- SoapUI Cookbook
- Building a Home Security System with Raspberry Pi
- PostgreSQL技術內幕:事務處理深度探索
- RTC程序設計:實時音視頻權威指南
- 匯編語言程序設計(第2版)
- 信息安全技術
- Learn React with TypeScript 3
- 從0到1:Python數據分析
- Getting Started with Gulp
- Orleans:構建高性能分布式Actor服務
- Python一行流:像專家一樣寫代碼
- Java自然語言處理(原書第2版)
- 關系數據庫與SQL Server 2012(第3版)
- 優化驅動的設計方法
- Distributed Computing with Python