javascriptliferay-6portlet

How to add javascript files to liferay-portlet.xml in liferay project


I'm developing an application with liferay 6.0.6 and want to add javascript files to my portlet. If I have two or three javascript files, how could I add them?

So here is my liferay-portlet.xml :

<portlet>
  <portlet-name>portletName</portlet-name>
  <icon>/icon.png</icon>
  <instanceable>true</instanceable>
  <header-portlet-css>/css/main.css</header-portlet-css>
  <footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
  <css-class-wrapper>portletName-portlet</css-class-wrapper>
</portlet>

Solution

  • <portlet>
      <portlet-name>portletName</portlet-name>
      <icon>/icon.png</icon>
      <instanceable>true</instanceable>
      <header-portlet-css>/css/main.css</header-portlet-css>
      <footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
      <footer-portlet-javascript>/js/view.js</footer-portlet-javascript>
      <footer-portlet-javascript>/js/controler.js</footer-portlet-javascript>
      <css-class-wrapper>portletName-portlet</css-class-wrapper>
    </portlet>
    

    For details see the xml schema definition: http://www.liferay.com/dtd/liferay-portlet-app_6_1_0.dtd