Refreshing the portlet at certain intervals in liferay
In our Project we have requirement to refresh the portlet at certain interval of times.
Thanks to liferay we have utility method to get the refreshURL.
Have a look into the PortletURLUtil class. we have getRefreshURL(---....) method to the current portlet URL.
So we have used in the following way in the jsp. As already we know "request" and "themeDisplay" Objects are predefined objects.
<%@page import="com.liferay.portlet.PortletURLUtil"%>
<script type="text/javascript">
setTimeout(openUrl, 5000); // Wait 5 seconds
function openUrl(){
window.open('<%=PortletURLUtil.getRefreshURL(request, themeDisplay) %>');
}
</script>
Thats it will refresh the portlet for every 5 seconds.
In PortletURLUtil also we have one more method to clone the URL, clone(----)
public static PortletURL clone(Thanks to liferay we have utility method to get the refreshURL.
Have a look into the PortletURLUtil class. we have getRefreshURL(---....) method to the current portlet URL.
So we have used in the following way in the jsp. As already we know "request" and "themeDisplay" Objects are predefined objects.
<%@page import="com.liferay.portlet.PortletURLUtil"%>
<script type="text/javascript">
setTimeout(openUrl, 5000); // Wait 5 seconds
function openUrl(){
window.open('<%=PortletURLUtil.getRefreshURL(request, themeDisplay) %>');
}
</script>
Thats it will refresh the portlet for every 5 seconds.
In PortletURLUtil also we have one more method to clone the URL, clone(----)
PortletURL portletURL, MimeResponse mimeResponse)
throws PortletException {
----
---
}
Comments
Post a Comment