Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to call external JS file (path set)
Hi ,
I wanted to add external JS file to the portlet. How can I set the path?
Thanks,
Arunyka
I wanted to add external JS file to the portlet. How can I set the path?
Thanks,
Arunyka
HI,
you can create that file inside ext-web/html/js
and you can set that path inside your jsp file like this:
<script src="/html/js/testing.js" type="text/javascript"></script>
HTH
you can create that file inside ext-web/html/js
and you can set that path inside your jsp file like this:
<script src="/html/js/testing.js" type="text/javascript"></script>
HTH
You can also add an entry in the liferay-portal.xml file.
<header-portlet-javascript>/js/testing.js</header-portlet-javascript>
This mechanism will add the reference to the javascript file once even if there were multiple instances of the portlet on the page.
<header-portlet-javascript>/js/testing.js</header-portlet-javascript>
This mechanism will add the reference to the javascript file once even if there were multiple instances of the portlet on the page.
Hi albert,
that way also we can include the js file. but if i want to include many js files, how to do?
can i include like this?
<header-portlet-javascript>/js/appointment/testing1.js</header-portlet-javascript>
<header-portlet-javascript>/js/appointment/testing2.js</header-portlet-javascript>
<header-portlet-javascript>/js/appointment/testing3.js</header-portlet-javascript>
.......etc
Thanks in advance
that way also we can include the js file. but if i want to include many js files, how to do?
can i include like this?
<header-portlet-javascript>/js/appointment/testing1.js</header-portlet-javascript>
<header-portlet-javascript>/js/appointment/testing2.js</header-portlet-javascript>
<header-portlet-javascript>/js/appointment/testing3.js</header-portlet-javascript>
.......etc
Thanks in advance
Yes you can. I am using a tree library from webfx. I also created my own javascript that I included after I included the webfx javascript code.
So you can have multiple header-portlet-javascript elements in your liferay-portlet.xml file.
Example:
<header-portlet-javascript>/js/webfx/webfx.js</header-portlet-javascript>
<header-portlet-javascript>/js/scripts.js</header-portlet-javascript>
So you can have multiple header-portlet-javascript elements in your liferay-portlet.xml file.
Example:
<header-portlet-javascript>/js/webfx/webfx.js</header-portlet-javascript>
<header-portlet-javascript>/js/scripts.js</header-portlet-javascript>
Hi,
Is it necessary to include "<instanceable>true</instanceable>" in liferay-portlet.xml file?
In my portlet class if i remove "<instanceable>true</instanceable>" it seems not working, if it placed then it is working
Then, if i make changes in my js file Liferay tomcat forced me to restart the sever.
What's wrong?
In my liferay-portlet.xml file,
<instanceable>true</instanceable>
<header-portlet-javascript>/html/portlet/book/author/main.js</header-portlet-javascript>
Is it necessary to include "<instanceable>true</instanceable>" in liferay-portlet.xml file?
In my portlet class if i remove "<instanceable>true</instanceable>" it seems not working, if it placed then it is working
Then, if i make changes in my js file Liferay tomcat forced me to restart the sever.
What's wrong?
In my liferay-portlet.xml file,
<instanceable>true</instanceable>
<header-portlet-javascript>/html/portlet/book/author/main.js</header-portlet-javascript>
Still no help from Liferay Team?
Thiago Leão Moreira, modified 14 Years ago.
Liferay Legend
Posts: 1449
Join Date: 10/10/07
Recent Posts
Hey Mani,
The <instanceable> tag does not have any influence in the javascript rendering.
The <instanceable> tag does not have any influence in the javascript rendering.
Hi Thiago,
I have created one portlet in liferay-portal-6.0.6\tomcat-6.0.29\webapps\ROOT\html\portlet\book\view.jsp
And my js file is in liferay-portal-6.0.6\tomcat-6.0.29\webapps\ROOT\html\portlet\book\js\main.js
Then my liferay-portlet.xml file,
<portlet>
<portlet-name>book</portlet-name>
<instanceable>true</instanceable>
<header-portlet-javascript>/html/portlet/book/js/main.js</header-portlet-javascript>
</portlet>
If I remove <instanceable>true</instanceable> my js file is not rendering if I call from jsp file.
If I include <instanceable>true</instanceable> my js file is rendering but if I make any changes in js file it is affecting after I restart the tomcat server.
I don't why its happening?
I have created one portlet in liferay-portal-6.0.6\tomcat-6.0.29\webapps\ROOT\html\portlet\book\view.jsp
And my js file is in liferay-portal-6.0.6\tomcat-6.0.29\webapps\ROOT\html\portlet\book\js\main.js
Then my liferay-portlet.xml file,
<portlet>
<portlet-name>book</portlet-name>
<instanceable>true</instanceable>
<header-portlet-javascript>/html/portlet/book/js/main.js</header-portlet-javascript>
</portlet>
If I remove <instanceable>true</instanceable> my js file is not rendering if I call from jsp file.
If I include <instanceable>true</instanceable> my js file is rendering but if I make any changes in js file it is affecting after I restart the tomcat server.
I don't why its happening?
Thiago Leão Moreira, modified 14 Years ago.
Liferay Legend
Posts: 1449
Join Date: 10/10/07
Recent Posts
You are developing your portlet in the wrong way, That's why the configurations are not working as expected. You SHOULDN'T change anything on liferay-portal-6.0.6\tomcat-6.0.29\webapps\ROOT.
This documentation teach you how to develop portlet right Portlet developoment
This documentation teach you how to develop portlet right Portlet developoment
Community
Company
Feedback