WCMMode Tags & FunctionsDeprecated
Available since version 1.0.0
Why is this deprecated?
Since AEM 6.0, you should be developing using HTL which does not support taglibs, but has its own wcmmode support.
Provide simple JSP custom tags and EL functions for determining the WCMMode.
First, add the taglib declaration:
<%@ taglib prefix="wcmmode" uri="http://www.adobe.com/consulting/acs-aem-commons/wcmmode" %>
JSP tags available are:
In each case, the body of the tag will be evaluated if the current WCMMode matches the tag name, e.g.
Each tag also takes a
not parameter which can be used to invert the logic, e.g.
EL Functions available are:
These would typically be used in a
<c:if> tag, e.g.
Switching between Edit and Preview modes
By default AEM does not reload content when an author switches between Edit and Preview modes. Since
tags execute server-side, this means they are calculated using the mode the page was originally
loaded as. For example, if an author loads a page in Edit mode, and then switches to Preview mode,
all content wrapped in
<wcmmode:edit> will still display since the page was loaded originally in Edit mode.
In order for
wcmmode tags to work correctly as the author switches between Edit and Preview mode without requiring
the author to manually refresh the browser page, you can add an authoring client library with category
cq.authoring.editor.hook that automatically refreshes the content behind the scenes as the author switches.