Pages

Monday 20 January 2014

How to refresh a page when a component is modified

A change was made to a component by an author. The page need to be refreshed in order to immediately reflect the change. Is there a way to automate this such that the author does not need to refresh the page? 

Resolution
The cq:listeners [cq:EditListenersConfig] is used to refresh the HTML page after a certain action is performed on a component. The cq:listeners node should be located as shown:
/component-name [cq:Component]
   /cq:editConfig [cq:editConfig]
      /cq:listeners [cq:EditListenersConfig]


NOTE: Text in the "[]" is the nodetype. Text after "/" is the node name -- should be extact name except for the "component-name".

The following properties are associated with cq:listeners node are:
aftercreate
afterdelete
afteredit
afterinsert
aftermove
afterremove
 

There are three possible values that can be assigned to the properties above -- either "REFRESH_SELF", "REFRESH_PARENT", "REFRESH_PAGE".

So, if you want your text component to cause a page refresh after each edit, you would create the following structure:
...
/mytextcomponent [cq:Component]
   /cq:editConfig [cq:editConfig]
      /cq:listeners [cq:EditListenersConfig]
         - afteredit {REFRESH_PAGE}             <= property {value}
   mytextcomponent.jsp                          <= code


Refer:

http://helpx.adobe.com/experience-manager/kb/RefreshPageWhenModifyDialog.html
 
 
 

No comments:

Post a Comment

Converting InputStream to String

    private String convertToString(InputStream inputStreamObj)             throws IOException {         if (inputStreamObj != null) {     ...