Next-generation platform

Refreshing portlet

You can refresh the portlet data periodically.

Before you begin

To refresh the data in the portlet, you must specify a refresh interval. You can provide this refresh interval as part of initialize application call.

You must add the attribute 'portletAutoRefreshInterval' inside extnJSONObject in the store-extn-include.jsp file. This JSP file is meant only for customization and there would be no product updates to this file. The value for this attribute is the refresh interval in seconds. The path for store-extn-include.jsp file inside the runtime is <runtime>/extensions/isf/webpages/storejsps/.

About this task

You can choose to externalize the refresh interval or hardcode it in the store-extn-include.jsp file. One of the ways to externalize the refresh interval is to store it in a properties file, read it in the store-extn-include.jsp file, and return it to the user interface layer. If you prefer to use this method, refer the steps in the following procedure.

Procedure

  1. Define a custom property in the customer_overrides.properties file, which takes the refresh interval value in seconds. For example, yfs.yfs.isf.ui.portletAutoRefreshInterval=10
  2. In the store-extn-include.jsp file, read this property and set the value in portletAutoRefreshInterval
    <%
    SCUIContext uiContext = SCUIContextHelper.getUIContext(request, response);
    String refreshInterval = APIManager.getInstance().getProperty("yfs.isf.ui.portletAutoRefreshInterval");
    JSONObject extnJSONObject = new JSONObject();
    extnJSONObject.put("portletAutoRefreshInterval", refreshInterval);
    request.setAttribute("extnDataJson",extnJSONObject.toString());
     %>