활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
Hello,
I am trying to create html attributes from a string with multiple attributes.
We have a string myAttrs = " class='myClass' id='myId' data-value='myCustomValue'".
I am trying to render that string as attributes of a html element.
Example input: <p ${myAttrs}> My paragraph </p>
Expected output: <p class='myClass' id='myId' data-value='myCustomValue'> My paragraph </p>
That does not work. Is there a sightly command to achieve my expected output without converting the string to a map and using data-sly-attribute?
Thank you
Have a look at data-sly-attribute, you can pass in a map.
https://docs.adobe.com/docs/en/htl/docs/block-statements.html
조회 수
답글
좋아요 수
Sorry missed you final sentence 🙂
Can you try @ context = 'unsafe'?
조회 수
답글
좋아요 수
I know I can pass a map, but this a integration with a legacy system build using jsp and I would prefer not convert to a map.
Tried 'context' and it didn't work.
조회 수
답글
좋아요 수
Tried indeed several things, but it isn't working..
What about creating a use-class that converts the String to a Map?
Then your integration can stay as is.
Yeah, that probably is going to be the solution.
I just think it is odd sightly removed a basic jsp functionality.
조회 수
답글
좋아요 수
Once you get this solution working - enter it into the AEM Immerse contest - we are looking for all sort of workgin AEM Solutions: http://scottsdigitalcommunity.blogspot.ca/2016/12/win-passes-to-experience-manager.html
It may win you access to the AEM Virtual Conference in May where you will get access to lots of awesome AEM sessions.
조회 수
답글
좋아요 수
Has any one found a solution to this ?
조회 수
답글
좋아요 수
Use-api to convert String into Hashmap
조회 수
답글
좋아요 수
Thanks Feike....I made it work like this.
<sly data-sly-test.a=${item.parsysIds}></sly>
<sly data-sly-test.b= "<dd ">
${a @context = 'unsafe'}${b @content='html'} class = "${item.parsysIds} ${wcmmode.edit ? '' : 'hide'}" id="${item.parsysIds}">
It returns me:
<dd notauthenticateduser class="notAuthenticatedUser hide" id="notAuthenticatedUser">
조회 수
답글
좋아요 수
Only problem with this approach is that the query selector gets updated to all lower case as you might see in the above example(notauthenticateduser).
Do you know if this can be resolved?
조회 수
답글
좋아요 수
Have you tried doing this use case with Sling Model and use Java logic to perform any data manipulation that you need - or are you trying all data manipulation in HTL syntax.
조회 수
답글
좋아요 수
For the time-being i am trying only using HTL and the solution worked for me however only issue is that the selector gets updated to lower case..
조회 수
답글
좋아요 수
One workaround is to use Sling Model and Java and use Java to modify the string to meet your requirements.
조회 수
답글
좋아요 수
Tried that too. However when i do a ${local Identifier.Object Properties} it returns me a blank. If i do xyz = ${local Identifier.Object Properties} then it renders me the proper authored value.
조회 수
답글
좋아요 수
조회 수
Likes
답글
조회 수
Likes
답글