/* InfoAxon GA Code */
Bootstrap Essentials
September 23, 2015 – 8:50 am | No Comment

Admittedly an august fervor for the publication and launch of my new book – Bootstrap Essentials.
No magnitude of thankfulness would be adequate to the Packtpub team and to my colleagues at InfoAxon.
Here are the links …

Read the full story »
Home » Open Source Tutorials

Tutorial: Building Alfresco web scripts, deploying as Liferay Portlets – Part 2

Submitted bySnig Bhaumik on October 3, 2009 – 6:24 am4 Comments

Creating a Web Script using JavaScript API

Step 1: Define the Web Script

As you know, to define a web script, we need to have:

  1. A description xml file, in our case the name would be helloworld.get.desc.xml
  2. An FTL file generating HTML code, in our case the name would be helloworld.get.html.ftl
  3. A JS file, in our case the name would be helloworld.get.js. Note that, this JS is technically not mandatory; however, in practical situation you cannot live without this, because this is only place where you write the business logic of your web script, and return some data.

These files need to be created in C:\mystackroot\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\ folder hierarchy.

  • Create subfolder hierarchy com\infoaxon\repository under C:\mystackroot\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\ folder.
  • Note that, maintaining this folder hierarchy is not mandatory; this is just because of good practice to group your web scripts. Technically as per alfresco, it will pick up all items which are defined as web scripts under the templates\webscripts\ folder.
  • Under the repository folder, create the following three files:
  • helloworld.get.desc.xml


    <p>Wow, this is quite ${jstext}, rather.</p>


    Step 2: Start Server, Test your Web Script

    That’s it, that’s really it, you have just created your first JavaScript based custom web script.

    • Start your server
    • In your favourite browser, navigate to http://localhost:8080/alfresco/service/index. Find your web script and test whether it is working, but just clicking on it.
    • Since, you have created a HTTP GET Web Script, you can invoke and test the service by typing URL in your browser http://localhost:8080/alfresco/service/infoaxon/helloworld. Note that, this is the URL which you have defined in your configuration XML file.

    In the next installment of this tutorial, we will discuss about how we can create a simple helloworld web script using java.

    About The Author

    Snig Bhaumik

    Mr. Snigdhendu Bikas Bhaumik is the Technical Director and Heads the Research and Development for InfoAxon. As an Open Source enthusiast, Snig is an active contributor of several open source communities such as - Alfresco ECM (Author of Alfresco Calendar components now included and distributed in Alfresco version 3.0), Liferay Portal and Pentaho Business Intelligence Suite. Snig has just completed a book on Alfresco published by Packtpub - http://www.packtpub.com/alfresco-3-cookbook/book. Snig specializes in Knowledge Management and Business Intelligence domains, and responsible for designing and architecting InfoAxon’s KM and BI solution offerings. He holds an enriching experience of around 12 years in designing, architecting and developing various solutions on open source technologies. Follow him on twitter - @snigbb.


    • Mahesh says:

      Your tutorial is very good for understanding the concept.
      But i want to know step by step for -
      How to deploy javascript based webscript as a life ray portlet?

    • Snig Bhaumik says:

      Please see the tutorial series part-4.

    • Animesh Kashyap says:

      I am working on POC for document search in alfresco. Do you have one working copy(Example) that can help despite of helloworld. I have developehd one bu t not able to retreive docs..

      Thanks in advance

    • Snig Bhaumik says:

      Hi Animesh

      Can you describe your requirement in more detail?
      Where from you want to search documents? Since alfresco of course offers extensive search capability from both the Explorer interface as well as from Share interface.

      Do you want to perform search via web scripts, in portlets etc?


    Leave a comment!

    Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

    Be nice. Keep it clean. Stay on topic. No spam.

    You can use these tags:
    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.