Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

className property for components

Avatar

Level 6

I saw a property called className in geometric outdoors component. What is its significance ?

1 Accepted Solution

Avatar

Correct answer by
Level 10

This is what you are referring to - its a property that belongs to a node of type wcm/mobile/components/page.

[img]className.png[/img]

This is referencing CSS class. Its used in the JSP logic as well:

 String className = component.getProperties().get("className", "");

 pageContext.setAttribute("className", StringEscapeUtils.escapeHtml4(className));

Then used in the <body > tag for style. 

View solution in original post

4 Replies

Avatar

Level 10

What component are you referring to? 

Avatar

Level 10

This is basically a property used to apply CSS style dynamically !!

Avatar

Level 6

There is a "page" and "page_mobile "component. That is the main template. 

For page component the className is "page"

For page_mobile component the className is "page-mobile"

Is it used for CSS ?

Avatar

Correct answer by
Level 10

This is what you are referring to - its a property that belongs to a node of type wcm/mobile/components/page.

[img]className.png[/img]

This is referencing CSS class. Its used in the JSP logic as well:

 String className = component.getProperties().get("className", "");

 pageContext.setAttribute("className", StringEscapeUtils.escapeHtml4(className));

Then used in the <body > tag for style.