Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Nivel 1
Nivel 2
Iniciar sesión en la comunidad
Iniciar sesión para ver todas las insignias
Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Hi everyone!
I would like to inject a page property into a Sling Model using annotations but I'm struggling. Like @ValueMapValue but for a page property.
Any ideas on how to do it?
Thanks!
¡Resuelto! Ir a solución.
Vistas
Respuestas
Total de me gusta
Page property is associated with the page and not to a component so I believe you cannot directly use inject or valuemapvalue to read the property.
However you can use the below annotations
@ScriptVariable
private ValueMap pageProperties;
@SlingObject
private Page currentPage;
which will read the properties and use the get method and retrieve the required property from the page.
Hope it helps
Vistas
Respuestas
Total de me gusta
Page property is associated with the page and not to a component so I believe you cannot directly use inject or valuemapvalue to read the property.
However you can use the below annotations
@ScriptVariable
private ValueMap pageProperties;
@SlingObject
private Page currentPage;
which will read the properties and use the get method and retrieve the required property from the page.
Hope it helps
Vistas
Respuestas
Total de me gusta
Hello @bruno-bradach
Sharing a cheat sheet for different annotations used in Sling Models (Including ValueMap).
https://sourcedcode.com/blog/aem/aem-sling-model-injectors-annotations-cheat-sheet-reference-guide
https://techrevel.blog/2017/03/18/sling-model-annotations/
It will help with current and later use-cases as well
Vistas
Respuestas
Total de me gusta
You can use thie hierarchical page property injector, easy! https://adobe-consulting-services.github.io/acs-aem-commons/features/sling-model-injectors/hierarchi... !
Vistas
Respuestas
Total de me gusta
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas