1

I have a requirement where I need to insert the value to custom data tag using thymeleaf. The code for doing it using

  data-th-attr="${data-custom=#messages.msg('test')}"

as well as

  th:attr="data-custom=${#messages.msg('test')}"

I am unable to get the value in both the cases.

ultimately the parsing should be like data-custom="test"

here test is key for the value test in a properties file

2 Answers 2

3

By using the

 data-th-attr="data-custom=#{test}" 

or By using

 th:attr="data-custom=#{test}"

helped me out, here test is the key for the value in message resource the issue was with the intellij IDEA IDE, it was having a bug that was showing me an unnecessary error.

Sign up to request clarification or add additional context in comments.

Comments

1

Use th:attr="data-custom=#{key.for.message}" , this should work.
then after parsing the Expression,
data-custom="value.for.message"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.