So I have this line in my HTML
<sly data-sly-use.menuItem="${'com.myhost.core.impl.view.global.TopNavigationItemView'}"></sly>
menuItem has many properties like id, activeclass and etc.
I would like to dump/show the full contents of menuItem without having to specify the properties (example: menuItem.id) individually.
Is this possible? If yes, how?
I tried this
<dl data-sly-list="${menuItem}">
<dt>index: ${itemList.index}</dt>
<dd>value: ${item.title}</dd>
</dl>
but I cannot see it in my page. I even tried "view page source" and nothing there.
Any ideas? Thanks!
You may need to create a new method in your Use Class as follows:
public String variableDump() {
return new ToStringBuilder(this).
// All your variables
append("name", name).
append("age", age).
append("smoker", smoker).
toString();
}
Then you can call this function in your HTL Template to dump all the variables.
why that would work for a custom class? what happens if I want to dump the contents of AEM built-in variables like $properties/$pageProperties?
Thanks
Views
Replies
Total Likes
Did you forget the concept of Encapsulation???
If you can get a dump of properties (which may be protected or private) then what is the benefit of encapsulation???
Views
Replies
Total Likes
try this example in sample6
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies