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(
PortletURL portletURL, MimeResponse mimeResponse)
throws PortletException {

----
---
}

Comments

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate