Accessing Dialog Properties in WCMUsePojo - getProperties() vs get() | Community
Skip to main content
Tyler_Maynard
Level 4
May 12, 2017
Solved

Accessing Dialog Properties in WCMUsePojo - getProperties() vs get()

  • May 12, 2017
  • 1 reply
  • 1945 views

I have a component embbedded onto a page using the following HTL markup:

<div data-sly-resource="${'myResource' @ resourceType='path/to/my/resource'}"></div>

In my component's  HTL I am using the java-use to access a local Java Class for logic:

<sly data-sly-use.articleSlider="ArticleSlider"></sly>

Within my Java class, I am accessing component dialog properties which are added by an author, but for some reason I can't simply use the get("propertyName", "String.class"). Trying to understand why I can't do that, but i can access it when using getProperties() method:

@Override public void activate() throws Exception { String featureByGetProperties = getProperties().get("featureone", ""); // <- THIS WORKS String featureByGet = get("featureone", String.class); // <- THIS IS NULL }

Everything I read (including the AEM Documentation) tells me that simply using the get() method should grab the property from the resource. Just trying to understand why one works and not the other.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Feike_Visser1

get() can be used when you pass in for example a parameter.

For the use-cases to get a property you need to access it via getProperties().

Where have you seen that in the documentation?

1 reply

Feike_Visser1
Adobe Employee
Feike_Visser1Adobe EmployeeAccepted solution
Adobe Employee
May 13, 2017

get() can be used when you pass in for example a parameter.

For the use-cases to get a property you need to access it via getProperties().

Where have you seen that in the documentation?