The following is a sample code of the View template of a content node:
Get a content node to display:
<%
def node = uicomponent.getNode() ;
def originalNode = uicomponent.getOriginalNode()
%>
Display the name of the content node:
<%=node.getName()%>
Display the exo:title property of the content node:
<%if(node.hasProperty("exo:title")) {
%>
<%=node.getProperty("exo:title").getString()%>
<%
}
%>
Display the exo:date property of the content node in a desired format. For example: "MM DD YYYY" or "YYYY MM DD".
<%
import java.text.SimpleDateFormat ;
SimpleDateFormat dateFormat = new SimpleDateFormat() ;
%>
...
<%
if(node.hasProperty("exo:date")) {
dateFormat.applyPattern("MMMMM dd yyyy") ;
%>
<%=dateFormat.format(node.getProperty("exo:date").getDate().getTime())%>
<%
}
%>
Display the translation of the Sample.view.label.node-name message in different languages.
<%=_ctx.appRes("Sample.view.label.node-name")%>